Skip to contentSkip to conversation

x86/cpufeatures: fix build warnings with sparse of capflags.o

PATCH New Ben Dooks 1 participant 1 message Jan 7 x86

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 x86/cpufeatures: fix build warnings with sparse of capflags.o

It seems that sparse builds don't define __KERNEL__ which means the check step of capflags.c is triggering the following sparse warnings. Fix this by checking for __CHECKER__ in addition to the __KERNEL__ check.

Fixes the following sparse warnings:
arch/x86/kernel/cpu/capflags.c:5:12: warning: symbol 'x86_cap_flags' was not declared. Should it be static? arch/x86/kernel/cpu/capflags.c:295:12: warning: symbol 'x86_bug_flags' was not declared. Should it be static? arch/x86/kernel/cpu/capflags.c:343:12: warning: symbol 'x86_vmx_flags' was not declared. Should it be static?

---
 arch/x86/include/asm/cpufeature.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/cpufeature.h +1 -1
index 3ddc1d33399b..484553adc27d 100644
@@ -4,7 +4,7 @@
 
 #include <asm/processor.h>
 
-#if defined(__KERNEL__) && !defined(__ASSEMBLER__)
+#if (defined(__KERNEL__) || defined(__CHECKER__)) && !defined(__ASSEMBLER__)
 
 #include <asm/asm.h>
 #include <linux/bitops.h>
Signature · 1 line
2.37.2.352.g3c44437643