Linux-mtd Archive on lore.kernel.org
 help / color / 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>,
	Joern Engel <joern@lazybastard.org>,
	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: phram: Mark expected switch fall-throughs
Date: Wed, 10 Apr 2019 14:46:45 -0700
Message-ID: <CAGXu5jJkrpGd+WWRx3C2Njp6jZ4UKU0KqinjqmTO8fxyfo7oOw@mail.gmail.com> (raw)
In-Reply-To: <20190208180911.GA32525@embeddedor>

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/

      parent reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 18:09 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 [this message]

Reply instructions:

You may reply publically 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=CAGXu5jJkrpGd+WWRx3C2Njp6jZ4UKU0KqinjqmTO8fxyfo7oOw@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gustavo@embeddedor.com \
    --cc=joern@lazybastard.org \
    --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

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