linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Boris Brezillon <bbrezillon@kernel.org>,
	Richard Weinberger <richard@nod.at>,
	LKML <linux-kernel@vger.kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	Linux mtd <linux-mtd@lists.infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] mtd: cfi_util: mark expected switch fall-throughs
Date: Wed, 10 Apr 2019 14:46:20 -0700	[thread overview]
Message-ID: <CAGXu5j+p6aSOR5Tz_0TkqC7k30yxsSzSU0vAP44a0dMCbtEaeQ@mail.gmail.com> (raw)
In-Reply-To: <20190208180202.GA16603@embeddedor>

On Fri, Feb 8, 2019 at 10:02 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/chips/cfi_util.c: In function ‘cfi_build_cmd’:
> drivers/mtd/chips/cfi_util.c:110:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    onecmd |= (onecmd << (chip_mode * 32));
>    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mtd/chips/cfi_util.c:112:2: note: here
>   case 4:
>   ^~~~
> drivers/mtd/chips/cfi_util.c:113:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    onecmd |= (onecmd << (chip_mode * 16));
>    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mtd/chips/cfi_util.c:114:2: note: here
>   case 2:
>   ^~~~
> drivers/mtd/chips/cfi_util.c: In function ‘cfi_merge_status’:
> drivers/mtd/chips/cfi_util.c:163:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    res |= (onestat >> (chip_mode * 32));
>    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mtd/chips/cfi_util.c:165:2: note: here
>   case 4:
>   ^~~~
> drivers/mtd/chips/cfi_util.c:166:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    res |= (onestat >> (chip_mode * 16));
>    ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/mtd/chips/cfi_util.c:167:2: note: here
>   case 2:
>   ^~~~
>
> 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/chips/cfi_util.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
> index 6f16552cd59f..e3b266ee06af 100644
> --- a/drivers/mtd/chips/cfi_util.c
> +++ b/drivers/mtd/chips/cfi_util.c
> @@ -109,10 +109,13 @@ map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi
>         case 8:
>                 onecmd |= (onecmd << (chip_mode * 32));
>  #endif
> +               /* fall through */
>         case 4:
>                 onecmd |= (onecmd << (chip_mode * 16));
> +               /* fall through */
>         case 2:
>                 onecmd |= (onecmd << (chip_mode * 8));
> +               /* fall through */
>         case 1:
>                 ;
>         }
> @@ -162,10 +165,13 @@ unsigned long cfi_merge_status(map_word val, struct map_info *map,
>         case 8:
>                 res |= (onestat >> (chip_mode * 32));
>  #endif
> +               /* fall through */
>         case 4:
>                 res |= (onestat >> (chip_mode * 16));
> +               /* fall through */
>         case 2:
>                 res |= (onestat >> (chip_mode * 8));
> +               /* fall through */
>         case 1:
>                 ;
>         }
> --
> 2.20.1
>


-- 
Kees Cook

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

      parent reply	other threads:[~2019-04-10 21:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 18:02 [PATCH] mtd: cfi_util: mark expected switch fall-throughs Gustavo A. R. Silva
2019-03-20 20:20 ` Gustavo A. R. Silva
2019-03-20 21:05   ` Richard Weinberger
2019-03-20 21:23     ` Gustavo A. R. Silva
2019-03-20 23:25       ` Richard Weinberger
2019-03-20 23:36         ` Gustavo A. R. Silva
2019-04-10 21:16   ` Gustavo A. R. Silva
2019-04-15  8:44     ` Miquel Raynal
2019-04-15 12:57       ` Gustavo A. R. Silva
2019-04-16 17:24         ` Miquel Raynal
2019-04-16 20:49           ` Gustavo A. R. Silva
2019-05-07 14:54             ` Gustavo A. R. Silva
2019-05-07 15:49               ` Richard Weinberger
2019-05-07 15:59                 ` Gustavo A. R. Silva
2019-05-09  6:53                   ` Miquel Raynal
2019-04-10 21:46 ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGXu5j+p6aSOR5Tz_0TkqC7k30yxsSzSU0vAP44a0dMCbtEaeQ@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).