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

Nathan Chancellor natechancellor at gmail.com
Sun Nov 29 20:07:55 EST 2020


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



More information about the linux-mtd mailing list