Skip to content

Commit

Permalink
kernel/sys.c: fix "warning: do-while statement is not a compound stat…
Browse files Browse the repository at this point in the history
…ement" noise

do_each_thread/while_each_thread wrap a block of code that is in this format:

	for (...)
		do
			...
		while

If curly braces do not surround the inner loop the following warning is
generated by sparse:

	warning: do-while statement is not a compound statement

Fix the warning by adding the braces.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
H Hartley Sweeten authored and Linus Torvalds committed Dec 15, 2009
1 parent 948c1e2 commit dfc6a73
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
!(user = find_user(who)))
goto out_unlock; /* No processes for this user */

do_each_thread(g, p)
do_each_thread(g, p) {
if (__task_cred(p)->uid == who)
error = set_one_prio(p, niceval, error);
while_each_thread(g, p);
} while_each_thread(g, p);
if (who != cred->uid)
free_uid(user); /* For find_user() */
break;
Expand Down Expand Up @@ -252,13 +252,13 @@ SYSCALL_DEFINE2(getpriority, int, which, int, who)
!(user = find_user(who)))
goto out_unlock; /* No processes for this user */

do_each_thread(g, p)
do_each_thread(g, p) {
if (__task_cred(p)->uid == who) {
niceval = 20 - task_nice(p);
if (niceval > retval)
retval = niceval;
}
while_each_thread(g, p);
} while_each_thread(g, p);
if (who != cred->uid)
free_uid(user); /* for find_user() */
break;
Expand Down

0 comments on commit dfc6a73

Please sign in to comment.