arm64: hw_breakpoint: mark expected switch fall-through
Subsystems (2)
PATCH 1/1 arm64: hw_breakpoint: mark expected switch fall-through
Mark switch cases where we are expecting to fall through, fixes the following warning:
CC arch/arm64/kernel/hw_breakpoint.oarch/arm64/kernel/hw_breakpoint.c: In function ‘hw_breakpoint_arch_parse’:arch/arm64/kernel/hw_breakpoint.c:540:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1)
^arch/arm64/kernel/hw_breakpoint.c:542:3: note: here
case 2:
^~~~arch/arm64/kernel/hw_breakpoint.c:544:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2)
^arch/arm64/kernel/hw_breakpoint.c:546:3: note: here
default:
^~~~~~~
--- arch/arm64/kernel/hw_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/hw_breakpoint.c +2 -0
@@ -539,10 +539,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,/* Allow single byte watchpoint. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 )break ; +/* fallthrough */ case 2 :/* Allow halfword watchpoints and breakpoints. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_2 )break ; +/* fallthrough */ default :return -EINVAL ; }
Signature · 1 line
2.21.0
Hi Matteo,
I sent a patch for this some minutes ago:
https://lore.kernel.org/patchwork/patch/1106585/
It seems there are more warnings in that file than the ones you are addressing.
Thanks
--
Gustavo
Quoted 31 lines · Matteo Croce
Mark switch cases where we are expecting to fall through, fixes the following warning:
CC
arch/arm64/kernel/hw_breakpoint.oarch/arm64/kernel/hw_breakpoint.c: In function ‘hw_breakpoint_arch_parse’:arch/arm64/kernel/hw_breakpoint.c:540:7: warning: this statement may fall through [-Wimplicit-fallthrough=]if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) ^ arch/arm64/kernel/hw_breakpoint.c:542:3: note: here case 2: ^~~~ arch/arm64/kernel/hw_breakpoint.c:544:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) ^ arch/arm64/kernel/hw_breakpoint.c:546:3: note: here default: ^~~~~~~Signed-off-by Matteo Croce <[email protected]>--- arch/arm64/kernel/hw_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/kernel/hw_breakpoint.c +0
-0@@ -539,10 +539,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,/* Allow single byte watchpoint. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 )
arch/arm64/kernel/hw_breakpoint.c int hw_breakpoint_arch_parse(struct perf_event *bp, · line 550
Quoted 10 lines
arch/arm64/kernel/hw_breakpoint.c +2
-0break ; +/* fallthrough */ case 2 :/* Allow halfword watchpoints and breakpoints. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_2 )break ; +/* fallthrough */ default :return -EINVAL ; }
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Feel free di discard the patch then.
What compiler are you using? I' using gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-6ubuntu1)
Quoted 56 lines · Gustavo A. R. Silva
Hi Matteo,
I sent a patch for this some minutes ago:
https://lore.kernel.org/patchwork/patch/1106585/
It seems there are more warnings in that file than the ones you are addressing.
Thanks
--
GustavoQuoted 41 lines · Matteo Croce
Mark switch cases where we are expecting to fall through, fixes the following warning:
CC
arch/arm64/kernel/hw_breakpoint.oarch/arm64/kernel/hw_breakpoint.c: In function ‘hw_breakpoint_arch_parse’:arch/arm64/kernel/hw_breakpoint.c:540:7: warning: this statement may fall through [-Wimplicit-fallthrough=]if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) ^ arch/arm64/kernel/hw_breakpoint.c:542:3: note: here case 2: ^~~~ arch/arm64/kernel/hw_breakpoint.c:544:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) ^ arch/arm64/kernel/hw_breakpoint.c:546:3: note: here default: ^~~~~~~Signed-off-by Matteo Croce <[email protected]>--- arch/arm64/kernel/hw_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/kernel/hw_breakpoint.c +2
-0@@ -539,10 +539,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,/* Allow single byte watchpoint. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 )break ; +/* fallthrough */ case 2 :/* Allow halfword watchpoints and breakpoints. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_2 )break ; +/* fallthrough */ default :return -EINVAL ; }
Signature · 2 lines
Matteo Croce per aspera ad upstream
Quoted 4 lines · Matteo Croce
Feel free di discard the patch then.
What compiler are you using? I' using gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-6ubuntu1)
My bad. My patch address the ones in arch/arm/kernel/hw_breakpoint.c
Your patch should be fine.
--
Gustavo
Quoted 61 lines
Quoted 56 lines · Gustavo A. R. Silva
Hi Matteo,
I sent a patch for this some minutes ago:
https://lore.kernel.org/patchwork/patch/1106585/
It seems there are more warnings in that file than the ones you are addressing.
Thanks
--
GustavoQuoted 41 lines · Matteo Croce
Mark switch cases where we are expecting to fall through, fixes the following warning:
CC
arch/arm64/kernel/hw_breakpoint.oarch/arm64/kernel/hw_breakpoint.c: In function ‘hw_breakpoint_arch_parse’:arch/arm64/kernel/hw_breakpoint.c:540:7: warning: this statement may fall through [-Wimplicit-fallthrough=]if (hw->ctrl.len == ARM_BREAKPOINT_LEN_1) ^ arch/arm64/kernel/hw_breakpoint.c:542:3: note: here case 2: ^~~~ arch/arm64/kernel/hw_breakpoint.c:544:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (hw->ctrl.len == ARM_BREAKPOINT_LEN_2) ^ arch/arm64/kernel/hw_breakpoint.c:546:3: note: here default: ^~~~~~~Signed-off-by Matteo Croce <[email protected]>--- arch/arm64/kernel/hw_breakpoint.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/kernel/hw_breakpoint.c +2
-0@@ -539,10 +539,12 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,/* Allow single byte watchpoint. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_1 )break ; +/* fallthrough */ case 2 :/* Allow halfword watchpoints and breakpoints. */ if (hw->ctrl.len ==ARM_BREAKPOINT_LEN_2 )break ; +/* fallthrough */ default :return -EINVAL ; }