Commit aa803771 authored by Joe Perches's avatar Joe Perches Committed by Shuah Khan

tools: Avoid comma separated statements

Use semicolons and braces.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent c8bd596f
......@@ -65,12 +65,14 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
ci = cj = ei = 0;
while (ci < cmds->cnt && ei < excludes->cnt) {
cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
if (cmp < 0)
if (cmp < 0) {
cmds->names[cj++] = cmds->names[ci++];
else if (cmp == 0)
ci++, ei++;
else if (cmp > 0)
} else if (cmp == 0) {
ci++;
ei++;
} else if (cmp > 0) {
ei++;
}
}
while (ci < cmds->cnt)
......
......@@ -99,13 +99,17 @@ static unsigned long string_to_frequency(const char *str)
continue;
if (str[cp] == '.') {
while (power > -1 && isdigit(str[cp+1]))
cp++, power--;
while (power > -1 && isdigit(str[cp+1])) {
cp++;
power--;
}
}
if (power >= -1) /* not enough => pad */
if (power >= -1) { /* not enough => pad */
pad = power + 1;
else /* to much => strip */
pad = 0, cp += power + 1;
} else { /* too much => strip */
pad = 0;
cp += power + 1;
}
/* check bounds */
if (cp <= 0 || cp + pad > NORM_FREQ_LEN - 1)
return 0;
......
......@@ -105,12 +105,16 @@ int main(int argc, char **argv)
gup.flags |= FOLL_WRITE;
fd = open("/sys/kernel/debug/gup_benchmark", O_RDWR);
if (fd == -1)
perror("open"), exit(1);
if (fd == -1) {
perror("open");
exit(1);
}
p = mmap(NULL, size, PROT_READ | PROT_WRITE, flags, filed, 0);
if (p == MAP_FAILED)
perror("mmap"), exit(1);
if (p == MAP_FAILED) {
perror("mmap");
exit(1);
}
gup.addr = (unsigned long)p;
if (thp == 1)
......@@ -123,8 +127,10 @@ int main(int argc, char **argv)
for (i = 0; i < repeats; i++) {
gup.size = size;
if (ioctl(fd, cmd, &gup))
perror("ioctl"), exit(1);
if (ioctl(fd, cmd, &gup)) {
perror("ioctl");
exit(1);
}
printf("Time: get:%lld put:%lld us", gup.get_delta_usec,
gup.put_delta_usec);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment