* [PATCH] arm64: hw_breakpoint: mark expected switch fall-through
@ 2019-07-28 23:27 Matteo Croce
2019-07-28 23:34 ` Gustavo A. R. Silva
0 siblings, 1 reply; 4+ messages in thread
From: Matteo Croce @ 2019-07-28 23:27 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel
Mark switch cases where we are expecting to fall through,
fixes the following warning:
CC arch/arm64/kernel/hw_breakpoint.o
arch/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 <mcroce@redhat.com>
---
arch/arm64/kernel/hw_breakpoint.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index dceb84520948..7d846985b133 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -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;
}
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: hw_breakpoint: mark expected switch fall-through
2019-07-28 23:27 [PATCH] arm64: hw_breakpoint: mark expected switch fall-through Matteo Croce
@ 2019-07-28 23:34 ` Gustavo A. R. Silva
2019-07-28 23:36 ` Matteo Croce
0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-28 23:34 UTC (permalink / raw)
To: Matteo Croce, linux-arm-kernel
Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel
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
On 7/28/19 6:27 PM, Matteo Croce wrote:
> Mark switch cases where we are expecting to fall through,
> fixes the following warning:
>
> CC arch/arm64/kernel/hw_breakpoint.o
> arch/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 <mcroce@redhat.com>
> ---
> arch/arm64/kernel/hw_breakpoint.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
> index dceb84520948..7d846985b133 100644
> --- a/arch/arm64/kernel/hw_breakpoint.c
> +++ b/arch/arm64/kernel/hw_breakpoint.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: hw_breakpoint: mark expected switch fall-through
2019-07-28 23:34 ` Gustavo A. R. Silva
@ 2019-07-28 23:36 ` Matteo Croce
2019-07-28 23:45 ` Gustavo A. R. Silva
0 siblings, 1 reply; 4+ messages in thread
From: Matteo Croce @ 2019-07-28 23:36 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Linux ARM, Mark Rutland, Catalin Marinas, Will Deacon, LKML
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)
On Mon, Jul 29, 2019 at 1:34 AM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> 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
>
> On 7/28/19 6:27 PM, Matteo Croce wrote:
> > Mark switch cases where we are expecting to fall through,
> > fixes the following warning:
> >
> > CC arch/arm64/kernel/hw_breakpoint.o
> > arch/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 <mcroce@redhat.com>
> > ---
> > arch/arm64/kernel/hw_breakpoint.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
> > index dceb84520948..7d846985b133 100644
> > --- a/arch/arm64/kernel/hw_breakpoint.c
> > +++ b/arch/arm64/kernel/hw_breakpoint.c
> > @@ -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;
> > }
> >
--
Matteo Croce
per aspera ad upstream
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm64: hw_breakpoint: mark expected switch fall-through
2019-07-28 23:36 ` Matteo Croce
@ 2019-07-28 23:45 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-28 23:45 UTC (permalink / raw)
To: Matteo Croce; +Cc: Linux ARM, Mark Rutland, Catalin Marinas, Will Deacon, LKML
On 7/28/19 6:36 PM, Matteo Croce wrote:
> 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
> On Mon, Jul 29, 2019 at 1:34 AM Gustavo A. R. Silva
> <gustavo@embeddedor.com> wrote:
>>
>> 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
>>
>> On 7/28/19 6:27 PM, Matteo Croce wrote:
>>> Mark switch cases where we are expecting to fall through,
>>> fixes the following warning:
>>>
>>> CC arch/arm64/kernel/hw_breakpoint.o
>>> arch/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 <mcroce@redhat.com>
>>> ---
>>> arch/arm64/kernel/hw_breakpoint.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
>>> index dceb84520948..7d846985b133 100644
>>> --- a/arch/arm64/kernel/hw_breakpoint.c
>>> +++ b/arch/arm64/kernel/hw_breakpoint.c
>>> @@ -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;
>>> }
>>>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-28 23:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-28 23:27 [PATCH] arm64: hw_breakpoint: mark expected switch fall-through Matteo Croce
2019-07-28 23:34 ` Gustavo A. R. Silva
2019-07-28 23:36 ` Matteo Croce
2019-07-28 23:45 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).