* [PATCH] mtd: nand: omap2: add missing braces
@ 2016-07-14 9:53 Arnd Bergmann
2016-07-14 13:04 ` Teresa Remmet
2016-07-14 15:58 ` Brian Norris
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-07-14 9:53 UTC (permalink / raw)
To: Brian Norris
Cc: Teresa Remmet, Arnd Bergmann, Boris Brezillon,
Richard Weinberger, David Woodhouse, Roger Quadros,
Tony Lindgren, Cooper Jr.,
Franklin, linux-mtd, linux-kernel
A bug fix just introduced incorrect behavior in the omap2 nand driver, as
found by gcc-6.1:
drivers/mtd/nand/omap2.c: In function 'omap_get_dt_info':
drivers/mtd/nand/omap2.c:1658:2: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (!info->elm_of_node)
^~
drivers/mtd/nand/omap2.c:1660:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
if (!info->elm_of_node)
^~
We clearly need to put the indented code into { } braces to get the intended
behavior.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 3bbca2c54f86 ("mtd: nand: omap2: Add check for old elm binding")
---
drivers/mtd/nand/omap2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index a36ad3d146a3..ab7c34096a62 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1655,10 +1655,11 @@ static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info)
/* detect availability of ELM module. Won't be present pre-OMAP4 */
info->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
- if (!info->elm_of_node)
+ if (!info->elm_of_node) {
info->elm_of_node = of_parse_phandle(child, "elm_id", 0);
if (!info->elm_of_node)
dev_dbg(dev, "ti,elm-id not in DT\n");
+ }
/* select ecc-scheme for NAND */
if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: omap2: add missing braces
2016-07-14 9:53 [PATCH] mtd: nand: omap2: add missing braces Arnd Bergmann
@ 2016-07-14 13:04 ` Teresa Remmet
2016-07-14 15:58 ` Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Teresa Remmet @ 2016-07-14 13:04 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Brian Norris, Boris Brezillon, Richard Weinberger,
David Woodhouse, Roger Quadros, Tony Lindgren, Cooper Jr.,
Franklin, linux-mtd, linux-kernel
Hello,
Am Donnerstag, den 14.07.2016, 11:53 +0200 schrieb Arnd Bergmann:
> A bug fix just introduced incorrect behavior in the omap2 nand driver, as
> found by gcc-6.1:
>
> drivers/mtd/nand/omap2.c: In function 'omap_get_dt_info':
> drivers/mtd/nand/omap2.c:1658:2: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (!info->elm_of_node)
> ^~
> drivers/mtd/nand/omap2.c:1660:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
> if (!info->elm_of_node)
> ^~
>
> We clearly need to put the indented code into { } braces to get the intended
> behavior.
how bad that I missed that :(.
But nice that gcc-6.1 catches such things.
Thanks,
Teresa
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 3bbca2c54f86 ("mtd: nand: omap2: Add check for old elm binding")
> ---
> drivers/mtd/nand/omap2.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index a36ad3d146a3..ab7c34096a62 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -1655,10 +1655,11 @@ static int omap_get_dt_info(struct device *dev, struct omap_nand_info *info)
>
> /* detect availability of ELM module. Won't be present pre-OMAP4 */
> info->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
> - if (!info->elm_of_node)
> + if (!info->elm_of_node) {
> info->elm_of_node = of_parse_phandle(child, "elm_id", 0);
> if (!info->elm_of_node)
> dev_dbg(dev, "ti,elm-id not in DT\n");
> + }
>
> /* select ecc-scheme for NAND */
> if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: omap2: add missing braces
2016-07-14 9:53 [PATCH] mtd: nand: omap2: add missing braces Arnd Bergmann
2016-07-14 13:04 ` Teresa Remmet
@ 2016-07-14 15:58 ` Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2016-07-14 15:58 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Teresa Remmet, Boris Brezillon, Richard Weinberger,
David Woodhouse, Roger Quadros, Tony Lindgren, Cooper Jr.,
Franklin, linux-mtd, linux-kernel
On Thu, Jul 14, 2016 at 11:53:48AM +0200, Arnd Bergmann wrote:
> A bug fix just introduced incorrect behavior in the omap2 nand driver, as
> found by gcc-6.1:
>
> drivers/mtd/nand/omap2.c: In function 'omap_get_dt_info':
> drivers/mtd/nand/omap2.c:1658:2: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (!info->elm_of_node)
> ^~
> drivers/mtd/nand/omap2.c:1660:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
> if (!info->elm_of_node)
> ^~
>
> We clearly need to put the indented code into { } braces to get the intended
> behavior.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 3bbca2c54f86 ("mtd: nand: omap2: Add check for old elm binding")
Wow, can't believe I missed that. Squashed into the original patch.
Thanks,
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-14 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 9:53 [PATCH] mtd: nand: omap2: add missing braces Arnd Bergmann
2016-07-14 13:04 ` Teresa Remmet
2016-07-14 15:58 ` Brian Norris
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.