mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-09 23:34:42 +08:00
powerpc/xmon: Fix -Wswitch-unreachable warning in bpt_cmds
[ Upstream commit1c4a4a4c84
] 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:09b6c1129f
("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6a310e8db5
commit
b31e9647f1
@ -1528,9 +1528,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;
|
||||
@ -1563,6 +1563,7 @@ bpt_cmds(void)
|
||||
|
||||
force_enable_xmon();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'i': /* bi - hardware instr breakpoint */
|
||||
if (xmon_is_ro) {
|
||||
|
Loading…
Reference in New Issue
Block a user