]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
sched/debug: Explicitly cast sched_feat() to bool
authorPeter Zijlstra <peterz@infradead.org>
Wed, 29 Aug 2018 09:45:21 +0000 (11:45 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 10 Sep 2018 09:05:54 +0000 (11:05 +0200)
LLVM has a warning that tags expressions like:

if (foo && non-bool-const)

This pattern triggers for CONFIG_SCHED_DEBUG=n where sched_feat() ends
up being whatever bit we select. Avoid the warning with an explicit
cast to bool.

Reported-by: Philipp Klocke <philipp97kl@gmail.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/sched.h

index 85b3a2bf6c2bf9882cd292a25cc8416fc0a8f9e9..3a4ef8f73f08b0e593b06e037bca5d5d748cfa89 100644 (file)
@@ -1401,7 +1401,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =
        0;
 #undef SCHED_FEAT
 
-#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
+#define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
 
 #endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */