]> git.baikalelectronics.ru Git - kernel.git/commit
sched: Fix DEBUG && !SCHEDSTATS warn
authorPeter Zijlstra <peterz@infradead.org>
Wed, 6 Oct 2021 08:12:05 +0000 (10:12 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 6 Oct 2021 08:30:57 +0000 (10:30 +0200)
commite2b3217c4776e1781efe79eb4d5fc57c9e53d6cf
tree5e5c6c358455c465750908d8a9a6e888b4e34ff1
parent5fb8051f99fb8e6b0bd4e2bbafd0914f7da7d3a6
sched: Fix DEBUG && !SCHEDSTATS warn

When !SCHEDSTATS schedstat_enabled() is an unconditional 0 and the
whole block doesn't exist, however GCC figures the scoped variable
'stats' is unused and complains about it.

Upgrade the warning from -Wunused-variable to -Wunused-but-set-variable
by writing it in two statements. This fixes the build because the new
warning is in W=1.

Given that whole if(0) {} thing, I don't feel motivated to change
things overly much and quite strongly feel this is the compiler being
daft.

Fixes: cb3e971c435d ("sched: Make struct sched_statistics independent of fair sched class")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
kernel/sched/debug.c