diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2022-09-16 17:15:04 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-11-24 15:31:47 +0300 |
commit | 1c4a4a4c8410be4a231a58b23e7a30923ff954ac (patch) | |
tree | cde9533d4e3b5bbd2fdf734f45f8b499a90e25f3 | |
parent | 4ac9d3187cc7ccba25f76a3faef3e08a366f77b9 (diff) | |
download | linux-1c4a4a4c8410be4a231a58b23e7a30923ff954ac.tar.xz |
powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds
When building with automatic stack variable initialization, GCC 12
complains about variables defined outside of switch case statements.
Move the variable into the case that uses it, which silences the warning:
arch/powerpc/xmon/xmon.c: In function ‘bpt_cmds’:
arch/powerpc/xmon/xmon.c:1529:13: warning: statement will never be executed [-Wswitch-unreachable]
1529 | int mode;
| ^~~~
Fixes: 09b6c1129f89 ("powerpc/xmon: Fix compile error with PPC_8xx=y")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/YySE6FHiOcbWWR+9@work
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index f51c882bf902..e34d7809f6c9 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -1525,9 +1525,9 @@ bpt_cmds(void) cmd = inchar(); switch (cmd) { - static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n"; - int mode; - case 'd': /* bd - hardware data breakpoint */ + case 'd': { /* bd - hardware data breakpoint */ + static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n"; + int mode; if (xmon_is_ro) { printf(xmon_ro_msg); break; @@ -1560,6 +1560,7 @@ bpt_cmds(void) force_enable_xmon(); break; + } case 'i': /* bi - hardware instr breakpoint */ if (xmon_is_ro) { |