linux-stable/arch/powerpc/xmon
Nathan Chancellor 13cebeeca2 powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc
[ Upstream commit e7140639b1 ]

When building with -Wsometimes-uninitialized, Clang warns:

  arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used
  uninitialized whenever 'if' condition is false
  [-Wsometimes-uninitialized]
    if (cpu_has_feature(CPU_FTRS_POWER9))
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here
    if (opcode == NULL)
        ^~~~~~
  arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its
  condition is always true
    if (cpu_has_feature(CPU_FTRS_POWER9))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable
  'opcode' to silence this warning
    const struct powerpc_opcode *opcode;
                                       ^
                                        = NULL
  1 warning generated.

This warning seems to make no sense on the surface because opcode is set
to NULL right below this statement. However, there is a comma instead of
semicolon to end the dialect assignment, meaning that the opcode
assignment only happens in the if statement. Properly terminate that
line so that Clang no longer warns.

Fixes: 5b102782c7 ("powerpc/xmon: Enable disassembly files (compilation changes)")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-05 22:31:30 +02:00
..
Makefile powerpc: Disable -Wbuiltin-requires-header when setjmp is used 2019-01-13 10:01:03 +01:00
ansidecl.h
dis-asm.h
nonstdio.c powerpc/xmon: Paged output for paca display 2015-10-15 20:32:01 +11:00
nonstdio.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ppc-dis.c powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc 2019-04-05 22:31:30 +02:00
ppc-opc.c powerpc updates for 4.11 part 2 2017-03-01 10:10:16 -08:00
ppc.h powerpc/xmon: Enable disassembly files (compilation changes) 2017-02-15 20:02:42 +11:00
spr_access.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
spu-dis.c
spu-insns.h
spu-opc.c bug.h: add include of it to various implicit C users 2012-02-29 17:15:08 -05:00
spu.h
xmon.c powerpc/xmon: Fix invocation inside lock region 2019-01-26 09:37:02 +01:00