mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
tools: Avoid comma separated statements
Use semicolons and braces. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user