Commit 1c4a4a4c authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Michael Ellerman
Browse files

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: 09b6c112 ("powerpc/xmon: Fix compile error with PPC_8xx=y")
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/YySE6FHiOcbWWR+9@work
parent 4ac9d318
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1525,9 +1525,9 @@ bpt_cmds(void)
	cmd = inchar();

	switch (cmd) {
	case 'd': {	/* bd - hardware data breakpoint */
		static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n";
		int mode;
	case 'd':	/* bd - hardware data breakpoint */
		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) {