Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mtd: phram: Mark expected switch fall-throughs
@ 2019-02-08 18:09 Gustavo A. R. Silva
  2019-03-20 20:19 ` Gustavo A. R. Silva
  2019-04-10 21:46 ` Kees Cook
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-08 18:09 UTC (permalink / raw)
  To: Joern Engel, David Woodhouse, Brian Norris, Boris Brezillon,
	Marek Vasut, Richard Weinberger
  Cc: linux-mtd, linux-kernel, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/mtd/devices/phram.c: In function ‘parse_num64’:
drivers/mtd/devices/phram.c:149:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
     shift += 10;
     ~~~~~~^~~~~
drivers/mtd/devices/phram.c:150:4: note: here
    case 'M':
    ^~~~
drivers/mtd/devices/phram.c:151:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
     shift += 10;
     ~~~~~~^~~~~
drivers/mtd/devices/phram.c:152:4: note: here
    case 'k':
    ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/mtd/devices/phram.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 9ee04b5f9311..8a8627c30aed 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -147,8 +147,10 @@ static int parse_num64(uint64_t *num64, char *token)
 			switch (token[len - 2]) {
 			case 'G':
 				shift += 10;
+				/* fall through */
 			case 'M':
 				shift += 10;
+				/* fall through */
 			case 'k':
 				shift += 10;
 				token[len - 2] = 0;
-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: phram: Mark expected switch fall-throughs
  2019-02-08 18:09 [PATCH] mtd: phram: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-03-20 20:19 ` Gustavo A. R. Silva
  2019-04-10 21:16   ` Gustavo A. R. Silva
  2019-04-10 21:46 ` Kees Cook
  1 sibling, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-03-20 20:19 UTC (permalink / raw)
  To: Joern Engel, David Woodhouse, Brian Norris, Boris Brezillon,
	Marek Vasut, Richard Weinberger
  Cc: linux-mtd, linux-kernel, Kees Cook

Hi all,

Friendly ping:

Who can take this?

Thanks
--
Gustavo

On 2/8/19 12:09 PM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> drivers/mtd/devices/phram.c: In function ‘parse_num64’:
> drivers/mtd/devices/phram.c:149:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>      shift += 10;
>      ~~~~~~^~~~~
> drivers/mtd/devices/phram.c:150:4: note: here
>     case 'M':
>     ^~~~
> drivers/mtd/devices/phram.c:151:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>      shift += 10;
>      ~~~~~~^~~~~
> drivers/mtd/devices/phram.c:152:4: note: here
>     case 'k':
>     ^~~~
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> This patch is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/mtd/devices/phram.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> index 9ee04b5f9311..8a8627c30aed 100644
> --- a/drivers/mtd/devices/phram.c
> +++ b/drivers/mtd/devices/phram.c
> @@ -147,8 +147,10 @@ static int parse_num64(uint64_t *num64, char *token)
>  			switch (token[len - 2]) {
>  			case 'G':
>  				shift += 10;
> +				/* fall through */
>  			case 'M':
>  				shift += 10;
> +				/* fall through */
>  			case 'k':
>  				shift += 10;
>  				token[len - 2] = 0;
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: phram: Mark expected switch fall-throughs
  2019-03-20 20:19 ` Gustavo A. R. Silva
@ 2019-04-10 21:16   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-04-10 21:16 UTC (permalink / raw)
  To: Joern Engel, David Woodhouse, Brian Norris, Boris Brezillon,
	Marek Vasut, Richard Weinberger
  Cc: linux-mtd, linux-kernel, Kees Cook

Hi all,

If no one cares I'll add this to my tree for 5.2.

Thanks
--
Gustavo

On 3/20/19 3:19 PM, Gustavo A. R. Silva wrote:
> Hi all,
> 
> Friendly ping:
> 
> Who can take this?
> 
> Thanks
> --
> Gustavo
> 
> On 2/8/19 12:09 PM, Gustavo A. R. Silva wrote:
>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>> cases where we are expecting to fall through.
>>
>> This patch fixes the following warnings:
>>
>> drivers/mtd/devices/phram.c: In function ‘parse_num64’:
>> drivers/mtd/devices/phram.c:149:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>      shift += 10;
>>      ~~~~~~^~~~~
>> drivers/mtd/devices/phram.c:150:4: note: here
>>     case 'M':
>>     ^~~~
>> drivers/mtd/devices/phram.c:151:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>      shift += 10;
>>      ~~~~~~^~~~~
>> drivers/mtd/devices/phram.c:152:4: note: here
>>     case 'k':
>>     ^~~~
>>
>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>
>> This patch is part of the ongoing efforts to enabling
>> -Wimplicit-fallthrough.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>  drivers/mtd/devices/phram.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
>> index 9ee04b5f9311..8a8627c30aed 100644
>> --- a/drivers/mtd/devices/phram.c
>> +++ b/drivers/mtd/devices/phram.c
>> @@ -147,8 +147,10 @@ static int parse_num64(uint64_t *num64, char *token)
>>  			switch (token[len - 2]) {
>>  			case 'G':
>>  				shift += 10;
>> +				/* fall through */
>>  			case 'M':
>>  				shift += 10;
>> +				/* fall through */
>>  			case 'k':
>>  				shift += 10;
>>  				token[len - 2] = 0;
>>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mtd: phram: Mark expected switch fall-throughs
  2019-02-08 18:09 [PATCH] mtd: phram: Mark expected switch fall-throughs Gustavo A. R. Silva
  2019-03-20 20:19 ` Gustavo A. R. Silva
@ 2019-04-10 21:46 ` Kees Cook
  1 sibling, 0 replies; 4+ messages in thread
From: Kees Cook @ 2019-04-10 21:46 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Boris Brezillon, Richard Weinberger, Joern Engel, LKML,
	Marek Vasut, Linux mtd, Brian Norris, David Woodhouse

On Fri, Feb 8, 2019 at 10:17 AM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/mtd/devices/phram.c: In function ‘parse_num64’:
> drivers/mtd/devices/phram.c:149:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>      shift += 10;
>      ~~~~~~^~~~~
> drivers/mtd/devices/phram.c:150:4: note: here
>     case 'M':
>     ^~~~
> drivers/mtd/devices/phram.c:151:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
>      shift += 10;
>      ~~~~~~^~~~~
> drivers/mtd/devices/phram.c:152:4: note: here
>     case 'k':
>     ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enabling
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/mtd/devices/phram.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> index 9ee04b5f9311..8a8627c30aed 100644
> --- a/drivers/mtd/devices/phram.c
> +++ b/drivers/mtd/devices/phram.c
> @@ -147,8 +147,10 @@ static int parse_num64(uint64_t *num64, char *token)
>                         switch (token[len - 2]) {
>                         case 'G':
>                                 shift += 10;
> +                               /* fall through */
>                         case 'M':
>                                 shift += 10;
> +                               /* fall through */
>                         case 'k':
>                                 shift += 10;
>                                 token[len - 2] = 0;
> --
> 2.20.1
>


-- 
Kees Cook

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 18:09 [PATCH] mtd: phram: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-03-20 20:19 ` Gustavo A. R. Silva
2019-04-10 21:16   ` Gustavo A. R. Silva
2019-04-10 21:46 ` Kees Cook

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org linux-mtd@archiver.kernel.org
	public-inbox-index linux-mtd


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/ public-inbox