From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
linux-mtd@lists.infradead.org,
Miquel Raynal <miquel.raynal@bootlin.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] mtd: onenand_base: Avoid fall-through warnings
Date: Wed, 22 May 2019 23:37:05 +0200 [thread overview]
Message-ID: <20190522233705.234d75d5@collabora.com> (raw)
In-Reply-To: <20190522180446.GA30082@embeddedor>
On Wed, 22 May 2019 13:04:46 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> NOTICE THAT:
>
> "...we don't know whether we need fallthroughs or breaks there and this
> is just a change to avoid having new warnings when switching to
> -Wimplicit-fallthrough but this change might be entirely wrong."[1]
>
> See the original thread of discussion here:
>
> https://lore.kernel.org/patchwork/patch/1036251/
>
> So, in preparation to enabling -Wimplicit-fallthrough, this patch silences
> the following warnings:
>
> drivers/mtd/nand/onenand/onenand_base.c: In function ‘onenand_check_features’:
> drivers/mtd/nand/onenand/onenand_base.c:3264:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (ONENAND_IS_DDP(this))
> ^
> drivers/mtd/nand/onenand/onenand_base.c:3284:2: note: here
> case ONENAND_DEVICE_DENSITY_2Gb:
> ^~~~
> drivers/mtd/nand/onenand/onenand_base.c:3288:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
> this->options |= ONENAND_HAS_UNLOCK_ALL;
> drivers/mtd/nand/onenand/onenand_base.c:3290:2: note: here
> case ONENAND_DEVICE_DENSITY_1Gb:
> ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> [1] https://lore.kernel.org/lkml/20190509085318.34a9d4be@xps13/
>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/mtd/nand/onenand/onenand_base.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
> index f41d76248550..6cf4df9f8c01 100644
> --- a/drivers/mtd/nand/onenand/onenand_base.c
> +++ b/drivers/mtd/nand/onenand/onenand_base.c
> @@ -3280,12 +3280,14 @@ static void onenand_check_features(struct mtd_info *mtd)
> if ((this->version_id & 0xf) == 0xe)
> this->options |= ONENAND_HAS_NOP_1;
> }
> + /* Fall through - ? */
So, the only thing that you'll re-use by falling through the next case
is the '->options |= ONENAND_HAS_UNLOCK_ALL' operation. I find it easier
to follow with an explicit copy of this line + a break.
>
> case ONENAND_DEVICE_DENSITY_2Gb:
> /* 2Gb DDP does not have 2 plane */
> if (!ONENAND_IS_DDP(this))
> this->options |= ONENAND_HAS_2PLANE;
> this->options |= ONENAND_HAS_UNLOCK_ALL;
> + /* Fall through - ? */
This fall through certainly doesn't make sense, as the only thing that
might be done in the 1Gb case is conditionally adding the
HAS_UNLOCK_ALL flag, and this flag is already unconditionally set.
Please add a break here.
>
> case ONENAND_DEVICE_DENSITY_1Gb:
> /* A-Die has all block unlock */
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] mtd: onenand_base: Avoid fall-through warnings
Date: Wed, 22 May 2019 23:37:05 +0200 [thread overview]
Message-ID: <20190522233705.234d75d5@collabora.com> (raw)
In-Reply-To: <20190522180446.GA30082@embeddedor>
On Wed, 22 May 2019 13:04:46 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> NOTICE THAT:
>
> "...we don't know whether we need fallthroughs or breaks there and this
> is just a change to avoid having new warnings when switching to
> -Wimplicit-fallthrough but this change might be entirely wrong."[1]
>
> See the original thread of discussion here:
>
> https://lore.kernel.org/patchwork/patch/1036251/
>
> So, in preparation to enabling -Wimplicit-fallthrough, this patch silences
> the following warnings:
>
> drivers/mtd/nand/onenand/onenand_base.c: In function ‘onenand_check_features’:
> drivers/mtd/nand/onenand/onenand_base.c:3264:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if (ONENAND_IS_DDP(this))
> ^
> drivers/mtd/nand/onenand/onenand_base.c:3284:2: note: here
> case ONENAND_DEVICE_DENSITY_2Gb:
> ^~~~
> drivers/mtd/nand/onenand/onenand_base.c:3288:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
> this->options |= ONENAND_HAS_UNLOCK_ALL;
> drivers/mtd/nand/onenand/onenand_base.c:3290:2: note: here
> case ONENAND_DEVICE_DENSITY_1Gb:
> ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> [1] https://lore.kernel.org/lkml/20190509085318.34a9d4be@xps13/
>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/mtd/nand/onenand/onenand_base.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
> index f41d76248550..6cf4df9f8c01 100644
> --- a/drivers/mtd/nand/onenand/onenand_base.c
> +++ b/drivers/mtd/nand/onenand/onenand_base.c
> @@ -3280,12 +3280,14 @@ static void onenand_check_features(struct mtd_info *mtd)
> if ((this->version_id & 0xf) == 0xe)
> this->options |= ONENAND_HAS_NOP_1;
> }
> + /* Fall through - ? */
So, the only thing that you'll re-use by falling through the next case
is the '->options |= ONENAND_HAS_UNLOCK_ALL' operation. I find it easier
to follow with an explicit copy of this line + a break.
>
> case ONENAND_DEVICE_DENSITY_2Gb:
> /* 2Gb DDP does not have 2 plane */
> if (!ONENAND_IS_DDP(this))
> this->options |= ONENAND_HAS_2PLANE;
> this->options |= ONENAND_HAS_UNLOCK_ALL;
> + /* Fall through - ? */
This fall through certainly doesn't make sense, as the only thing that
might be done in the 1Gb case is conditionally adding the
HAS_UNLOCK_ALL flag, and this flag is already unconditionally set.
Please add a break here.
>
> case ONENAND_DEVICE_DENSITY_1Gb:
> /* A-Die has all block unlock */
next prev parent reply other threads:[~2019-05-22 21:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 18:04 [PATCH] mtd: onenand_base: Avoid fall-through warnings Gustavo A. R. Silva
2019-05-22 18:04 ` Gustavo A. R. Silva
2019-05-22 21:30 ` Kees Cook
2019-05-22 21:30 ` Kees Cook
2019-05-22 21:57 ` Boris Brezillon
2019-05-22 21:57 ` Boris Brezillon
2019-05-22 22:20 ` Kees Cook
2019-05-22 22:20 ` Kees Cook
2019-05-22 22:30 ` Gustavo A. R. Silva
2019-05-22 22:30 ` Gustavo A. R. Silva
2019-05-22 21:37 ` Boris Brezillon [this message]
2019-05-22 21:37 ` Boris Brezillon
2019-05-22 21:45 ` Kees Cook
2019-05-22 21:45 ` Kees Cook
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=20190522233705.234d75d5@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=gustavo@embeddedor.com \
--cc=keescook@chromium.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.