Skip to content

Commit

Permalink
x86/microcode/AMD: Fix a -Wsometimes-uninitialized clang false positive
Browse files Browse the repository at this point in the history
Initialize equiv_id in order to shut up:

  arch/x86/kernel/cpu/microcode/amd.c:714:6: warning: variable 'equiv_id' is \
  used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (x86_family(bsp_cpuid_1_eax) < 0x17) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

because clang doesn't do interprocedural analysis for warnings to see
that this variable won't be used uninitialized.

Fixes: 94838d2 ("x86/microcode/AMD: Use the family,model,stepping encoded in the patch ID")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
  • Loading branch information
bp3tk0v committed Jul 30, 2024
1 parent 94838d2 commit 5343558
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/microcode/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ static struct ucode_patch *find_patch(unsigned int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
u32 rev, dummy __always_unused;
u16 equiv_id;
u16 equiv_id = 0;

/* fetch rev if not populated yet: */
if (!uci->cpu_sig.rev) {
Expand Down

0 comments on commit 5343558

Please sign in to comment.