2020-03-06 12:51:07

by Serge Semin

[permalink] [raw]
Subject: [PATCH 18/22] tty: mips_ejtag_fdc: Mark expected switch fall-through

From: Serge Semin <[email protected]>

Mark mips_ejtag_fdc_encode() methods switch-case-4 as expecting to
fall through.

This patch fixes the following warning:

drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_encode’:
drivers/tty/mips_ejtag_fdc.c:245:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
word.word &= 0x00ffffff;
~~~~~~~~~~^~~~~~~~~~~~~
drivers/tty/mips_ejtag_fdc.c:246:2: note: here
case 3:
^~~~

Signed-off-by: Serge Semin <[email protected]>
Signed-off-by: Alexey Malahov <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Ralf Baechle <[email protected]>
---
drivers/tty/mips_ejtag_fdc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
index 620d8488b83e..21e76a2ec182 100644
--- a/drivers/tty/mips_ejtag_fdc.c
+++ b/drivers/tty/mips_ejtag_fdc.c
@@ -243,6 +243,7 @@ static struct fdc_word mips_ejtag_fdc_encode(const char **ptrs,
/* Fall back to a 3 byte encoding */
word.bytes = 3;
word.word &= 0x00ffffff;
+ /* Fall through */
case 3:
/* 3 byte encoding */
word.word |= 0x82000000;
--
2.25.1


2020-03-09 16:14:46

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 18/22] tty: mips_ejtag_fdc: Mark expected switch fall-through

On 06. 03. 20, 13:47, [email protected] wrote:
> From: Serge Semin <[email protected]>
>
> Mark mips_ejtag_fdc_encode() methods switch-case-4 as expecting to
> fall through.
>
> This patch fixes the following warning:
>
> drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_encode’:
> drivers/tty/mips_ejtag_fdc.c:245:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
> word.word &= 0x00ffffff;
> ~~~~~~~~~~^~~~~~~~~~~~~
> drivers/tty/mips_ejtag_fdc.c:246:2: note: here
> case 3:
> ^~~~
>
> Signed-off-by: Serge Semin <[email protected]>
> Signed-off-by: Alexey Malahov <[email protected]>
> Cc: Thomas Bogendoerfer <[email protected]>
> Cc: Paul Burton <[email protected]>
> Cc: Ralf Baechle <[email protected]>
> ---
> drivers/tty/mips_ejtag_fdc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
> index 620d8488b83e..21e76a2ec182 100644
> --- a/drivers/tty/mips_ejtag_fdc.c
> +++ b/drivers/tty/mips_ejtag_fdc.c
> @@ -243,6 +243,7 @@ static struct fdc_word mips_ejtag_fdc_encode(const char **ptrs,
> /* Fall back to a 3 byte encoding */
> word.bytes = 3;
> word.word &= 0x00ffffff;
> + /* Fall through */

We now have "fallthrough;", so I believe you should use that instead of
comments.

thanks,
--
js
suse labs

2020-03-10 01:07:52

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH 18/22] tty: mips_ejtag_fdc: Mark expected switch fall-through

On Mon, Mar 09, 2020 at 05:12:40PM +0100, Jiri Slaby wrote:
> On 06. 03. 20, 13:47, [email protected] wrote:
> > From: Serge Semin <[email protected]>
> >
> > Mark mips_ejtag_fdc_encode() methods switch-case-4 as expecting to
> > fall through.
> >
> > This patch fixes the following warning:
> >
> > drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_encode’:
> > drivers/tty/mips_ejtag_fdc.c:245:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > word.word &= 0x00ffffff;
> > ~~~~~~~~~~^~~~~~~~~~~~~
> > drivers/tty/mips_ejtag_fdc.c:246:2: note: here
> > case 3:
> > ^~~~
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > Signed-off-by: Alexey Malahov <[email protected]>
> > Cc: Thomas Bogendoerfer <[email protected]>
> > Cc: Paul Burton <[email protected]>
> > Cc: Ralf Baechle <[email protected]>
> > ---
> > drivers/tty/mips_ejtag_fdc.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
> > index 620d8488b83e..21e76a2ec182 100644
> > --- a/drivers/tty/mips_ejtag_fdc.c
> > +++ b/drivers/tty/mips_ejtag_fdc.c
> > @@ -243,6 +243,7 @@ static struct fdc_word mips_ejtag_fdc_encode(const char **ptrs,
> > /* Fall back to a 3 byte encoding */
> > word.bytes = 3;
> > word.word &= 0x00ffffff;
> > + /* Fall through */
>
> We now have "fallthrough;", so I believe you should use that instead of
> comments.
>

Hello Jiri,

Thanks for the comment. I didn't know about that new macro. Since Greg
already pulled this patch in his tty-next branch, I won't send an
update in the next patchset revision. But I'll certainly remember that
there is a specific macro to fix the fallthrough warning in the kernel
and will use it next time I find the same problem someplace else.

Regards,
-Sergey

> thanks,
> --
> js
> suse labs

2020-03-17 12:28:48

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 18/22] tty: mips_ejtag_fdc: Mark expected switch fall-through

On 10. 03. 20, 2:06, Sergey Semin wrote:
> On Mon, Mar 09, 2020 at 05:12:40PM +0100, Jiri Slaby wrote:
>> On 06. 03. 20, 13:47, [email protected] wrote:
>>> From: Serge Semin <[email protected]>
>>>
>>> Mark mips_ejtag_fdc_encode() methods switch-case-4 as expecting to
>>> fall through.
>>>
>>> This patch fixes the following warning:
>>>
>>> drivers/tty/mips_ejtag_fdc.c: In function ‘mips_ejtag_fdc_encode’:
>>> drivers/tty/mips_ejtag_fdc.c:245:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>> word.word &= 0x00ffffff;
>>> ~~~~~~~~~~^~~~~~~~~~~~~
>>> drivers/tty/mips_ejtag_fdc.c:246:2: note: here
>>> case 3:
>>> ^~~~
>>>
>>> Signed-off-by: Serge Semin <[email protected]>
>>> Signed-off-by: Alexey Malahov <[email protected]>
>>> Cc: Thomas Bogendoerfer <[email protected]>
>>> Cc: Paul Burton <[email protected]>
>>> Cc: Ralf Baechle <[email protected]>
>>> ---
>>> drivers/tty/mips_ejtag_fdc.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
>>> index 620d8488b83e..21e76a2ec182 100644
>>> --- a/drivers/tty/mips_ejtag_fdc.c
>>> +++ b/drivers/tty/mips_ejtag_fdc.c
>>> @@ -243,6 +243,7 @@ static struct fdc_word mips_ejtag_fdc_encode(const char **ptrs,
>>> /* Fall back to a 3 byte encoding */
>>> word.bytes = 3;
>>> word.word &= 0x00ffffff;
>>> + /* Fall through */
>>
>> We now have "fallthrough;", so I believe you should use that instead of
>> comments.
>>
>
> Hello Jiri,
>
> Thanks for the comment. I didn't know about that new macro. Since Greg
> already pulled this patch in his tty-next branch, I won't send an
> update in the next patchset revision.

Hi, OK -- now there is a whole-tree conversion undergoing anyway, so I
think they will take care about this one too...

thanks,
--
js
suse labs