2020-11-20 18:36:59

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH 060/141] habanalabs: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a fallthrough pseudo-keyword instead of letting the
code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <[email protected]>
---
drivers/misc/habanalabs/gaudi/gaudi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 2519a34e25b7..eab4c0dc65c5 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -5436,6 +5436,7 @@ static void gaudi_handle_ecc_event(struct hl_device *hdev, u16 event_type,
params.num_memories = 33;
params.derr = true;
params.disable_clock_gating = true;
+ fallthrough;
default:
return;
}
--
2.27.0


2020-11-21 12:38:06

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH 060/141] habanalabs: Fix fall-through warnings for Clang

On Fri, Nov 20, 2020 at 8:33 PM Gustavo A. R. Silva
<[email protected]> wrote:
>
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> by explicitly adding a fallthrough pseudo-keyword instead of letting the
> code fall through to the next case.
>
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva <[email protected]>
> ---
> drivers/misc/habanalabs/gaudi/gaudi.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
> index 2519a34e25b7..eab4c0dc65c5 100644
> --- a/drivers/misc/habanalabs/gaudi/gaudi.c
> +++ b/drivers/misc/habanalabs/gaudi/gaudi.c
> @@ -5436,6 +5436,7 @@ static void gaudi_handle_ecc_event(struct hl_device *hdev, u16 event_type,
> params.num_memories = 33;
> params.derr = true;
> params.disable_clock_gating = true;
> + fallthrough;
> default:
> return;
> }
> --
> 2.27.0
>
Hi Gustavo,
So this is actually an error in the code, there shouldn't be a
fallthrough there.
So NAK for this patch, I'll have to send a fix for that.
Thanks for catching this :)

Oded

2020-11-23 22:57:58

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 060/141] habanalabs: Fix fall-through warnings for Clang

On Sat, Nov 21, 2020 at 02:34:23PM +0200, Oded Gabbay wrote:
> On Fri, Nov 20, 2020 at 8:33 PM Gustavo A. R. Silva
> <[email protected]> wrote:
> >
> > In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> > by explicitly adding a fallthrough pseudo-keyword instead of letting the
> > code fall through to the next case.
> >
> > Link: https://github.com/KSPP/linux/issues/115
> > Signed-off-by: Gustavo A. R. Silva <[email protected]>
> > ---
> > drivers/misc/habanalabs/gaudi/gaudi.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
> > index 2519a34e25b7..eab4c0dc65c5 100644
> > --- a/drivers/misc/habanalabs/gaudi/gaudi.c
> > +++ b/drivers/misc/habanalabs/gaudi/gaudi.c
> > @@ -5436,6 +5436,7 @@ static void gaudi_handle_ecc_event(struct hl_device *hdev, u16 event_type,
> > params.num_memories = 33;
> > params.derr = true;
> > params.disable_clock_gating = true;
> > + fallthrough;
> > default:
> > return;
> > }
> > --
> > 2.27.0
> >
> Hi Gustavo,
> So this is actually an error in the code, there shouldn't be a
> fallthrough there.
> So NAK for this patch, I'll have to send a fix for that.
> Thanks for catching this :)

Awesome. Glad this helped to catch a bug. :)

Thanks
--
Gustavo