]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: jz4740: fix probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 25 Jul 2018 13:31:44 +0000 (15:31 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 31 Jul 2018 07:46:10 +0000 (09:46 +0200)
An error after nand_scan_tail() should trigger a nand_cleanup(), not a
nand_release() as mtd_device_register() (or one of its variants) has not
been called and there is no need to deregister any MTD device yet.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/nand/raw/jz4740_nand.c

index a4052b03249c78d37a8b17274fa13c18a81c1e00..3abf87420c10d1e4975a05018e01e1ef14bf6795 100644 (file)
@@ -472,15 +472,15 @@ static int jz_nand_probe(struct platform_device *pdev)
 
        if (ret) {
                dev_err(&pdev->dev, "Failed to add mtd device\n");
-               goto err_nand_release;
+               goto err_cleanup_nand;
        }
 
        dev_info(&pdev->dev, "Successfully registered JZ4740 NAND driver\n");
 
        return 0;
 
-err_nand_release:
-       nand_release(mtd);
+err_cleanup_nand:
+       nand_cleanup(chip);
 err_unclaim_banks:
        while (chipnr--) {
                unsigned char bank = nand->banks[chipnr];