[PATCH 17/19] mtd: rawnand: r852: Move the ECC initialization to ->attach_chip()

Miquel Raynal miquel.raynal at bootlin.com
Mon Nov 30 03:04:12 EST 2020


Hi Nathan,

Nathan Chancellor <natechancellor at gmail.com> wrote on Sun, 29 Nov 2020
18:07:55 -0700:

> On Fri, Nov 13, 2020 at 01:34:22PM +0100, Miquel Raynal wrote:
> > The probe function is only supposed to initialize the controller
> > hardware but not the ECC engine. Indeed, we don't know anything about
> > the NAND chip(s) at this stage. Let's move the logic initializing the
> > ECC engine, even pretty simple, to the ->attach_chip() hook which gets
> > called during nand_scan() routine, after the NAND chip discovery. As
> > the previously mentioned logic is supposed to parse the DT for us, it
> > is likely that the chip->ecc.* entries be overwritten. So let's avoid
> > this by moving these lines to ->attach_chip().
> > 
> > Fixes: d7157ff49a5b ("mtd: rawnand: Use the ECC framework user input parsing bits")
> > Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
> > Cc: Maxim Levitsky <maximlevitsky at gmail.com>  
> 
> Just as a heads up, this patch was applied to mtd/fixes as
> commit 7ef969a04228 ("mtd: rawnand: r852: Move the ECC
> initialization to ->attach_chip()") but it appears to also be applied to
> nand/next as commit 0c2b69f55132 ("mtd: rawnand: r852: Move the ECC
> initialization to ->attach_chip()"), where due to its mismerged nature,
> it causes a clang warning:
> 
> ../drivers/mtd/nand/raw/r852.c:874:24: warning: variable 'dev' is uninitialized when used here [-Wuninitialized]
>         nand_controller_init(&dev->controller);
>                               ^~~
> ../drivers/mtd/nand/raw/r852.c:847:25: note: initialize the variable 'dev' to silence this warning
>         struct r852_device *dev;
>                                ^
>                                 = NULL
> 1 warning generated.
> 
> Cheers,
> Nathan Chancellor

Absolutely, this fix came late, nand/next was already set up and there
was conflicts between the two. I applied these same patches at the root
of nand/next to be sure the branch would still be valid until the next
-rc would come out (today).

Thanks,
Miquèl



More information about the linux-mtd mailing list