x86/microcode: make stub function static inline
diff mbox series

Message ID 52170.1575603873@turing-police
State Accepted
Commit 82c881b28aa89215a760e39c5f6bcde2d6ce4918
Headers show
Series
  • x86/microcode: make stub function static inline
Related show

Commit Message

Valdis Kl ē tnieks Dec. 6, 2019, 3:44 a.m. UTC
When building with C=1 W=1, both sparse and gcc complain:

  CHECK   arch/x86/kernel/cpu/microcode/core.c
./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
  CC      arch/x86/kernel/cpu/microcode/core.o
In file included from arch/x86/kernel/cpu/microcode/core.c:36:
./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
]
   56 | void reload_ucode_amd(void) {}
      |      ^~~~~~~~~~~~~~~~

And they're right - that function can be a static inline like its brethren.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

Comments

Borislav Petkov Dec. 11, 2019, 9:38 p.m. UTC | #1
On Thu, Dec 05, 2019 at 10:44:33PM -0500, Valdis Klētnieks wrote:
> When building with C=1 W=1, both sparse and gcc complain:
> 
>   CHECK   arch/x86/kernel/cpu/microcode/core.c
> ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
>   CC      arch/x86/kernel/cpu/microcode/core.o
> In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> ]

Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.
Valdis Kl ē tnieks Dec. 11, 2019, 11:33 p.m. UTC | #2
On Wed, 11 Dec 2019 22:38:19 +0100, Borislav Petkov said:

> >   CHECK   arch/x86/kernel/cpu/microcode/core.c
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
> >   CC      arch/x86/kernel/cpu/microcode/core.o
> > In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> > ]
>
> Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.

Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2 so sparse is run?
Borislav Petkov Dec. 12, 2019, 8:58 a.m. UTC | #3
On Wed, Dec 11, 2019 at 06:33:53PM -0500, Valdis Klētnieks wrote:
> Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2
> so sparse is run?

[boris@zn: ~/kernel/linux> make W=1 C=1 arch/x86/kernel/cpu/microcode/
...

  LINK     /mnt/kernel/kernel/linux/tools/objtool/objtool
  CHECK   arch/x86/kernel/cpu/microcode/core.c
  CC      arch/x86/kernel/cpu/microcode/core.o
  CHECK   arch/x86/kernel/cpu/microcode/intel.c
  CC      arch/x86/kernel/cpu/microcode/intel.o
  CHECK   arch/x86/kernel/cpu/microcode/amd.c
arch/x86/kernel/cpu/microcode/amd.c:421:35: warning: Using plain integer as NULL pointer
arch/x86/kernel/cpu/microcode/amd.c:546:35: warning: Using plain integer as NULL pointer
  CC      arch/x86/kernel/cpu/microcode/amd.o
  AR      arch/x86/kernel/cpu/microcode/built-in.a

[boris@zn: ~/kernel/linux> git clean -dqfx

...

[boris@zn: ~/kernel/linux> make W=1 C=2 arch/x86/kernel/cpu/microcode/

  LINK     /mnt/kernel/kernel/linux/tools/objtool/objtool
  CHECK   arch/x86/kernel/cpu/microcode/core.c
  CC      arch/x86/kernel/cpu/microcode/core.o
  CHECK   arch/x86/kernel/cpu/microcode/intel.c
  CC      arch/x86/kernel/cpu/microcode/intel.o
  CHECK   arch/x86/kernel/cpu/microcode/amd.c
arch/x86/kernel/cpu/microcode/amd.c:421:35: warning: Using plain integer as NULL pointer
arch/x86/kernel/cpu/microcode/amd.c:546:35: warning: Using plain integer as NULL pointer
  CC      arch/x86/kernel/cpu/microcode/amd.o
  AR      arch/x86/kernel/cpu/microcode/built-in.a
Luc Van Oostenryck Dec. 12, 2019, 10:06 a.m. UTC | #4
On Thu, Dec 12, 2019 at 09:58:09AM +0100, Borislav Petkov wrote:
> On Wed, Dec 11, 2019 at 06:33:53PM -0500, Valdis Klētnieks wrote:
> > Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2
> > so sparse is run?
> 
> [boris@zn: ~/kernel/linux> make W=1 C=1 arch/x86/kernel/cpu/microcode/
> ...

The Sparse warning about reload_ucode_amd() is only present if your
config has CONFIG_MICROCODE_AMD not set.

Best regards,
-- Luc
Borislav Petkov Dec. 12, 2019, 10:49 a.m. UTC | #5
On Thu, Dec 12, 2019 at 11:06:09AM +0100, Luc Van Oostenryck wrote:
> The Sparse warning about reload_ucode_amd() is only present if your
> config has CONFIG_MICROCODE_AMD not set.

Ha, of course. Otherwise it doesn't see the

void reload_ucode_amd(void) {}

declaration.

Thanks for pointing this out.
David Laight Dec. 12, 2019, 12:22 p.m. UTC | #6
From Borislav Petkov
> Sent: 11 December 2019 21:38
> On Thu, Dec 05, 2019 at 10:44:33PM -0500, Valdis Klētnieks wrote:
> > When building with C=1 W=1, both sparse and gcc complain:
> >
> >   CHECK   arch/x86/kernel/cpu/microcode/core.c
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
> >   CC      arch/x86/kernel/cpu/microcode/core.o
> > In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> > ]
> 
> Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.

ISTR it is gcc-version dependant.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Patch
diff mbox series

diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index 209492849566..6685e1218959 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -53,6 +53,6 @@  static inline void __init load_ucode_amd_bsp(unsigned int family) {}
 static inline void load_ucode_amd_ap(unsigned int family) {}
 static inline int __init
 save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
-void reload_ucode_amd(void) {}
+static inline void reload_ucode_amd(void) {}
 #endif
 #endif /* _ASM_X86_MICROCODE_AMD_H */