]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: lpc32xx_slc: fix the probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sat, 21 Apr 2018 18:00:43 +0000 (20:00 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 29 Apr 2018 06:56:46 +0000 (08:56 +0200)
An error after nand_scan_tail() should trigger a nand_cleanup() and not
a nand_release(). The latter doing an mtd_device_unregister() which is
not needed if mtd_device_register() failed.

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

index 064c9389ee0c64d9b9aeccf11fb9ed2f3a5dc97e..42820aa1abab348fcdb2c2c9a4b236e7f62e060c 100644 (file)
@@ -926,12 +926,12 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        res = mtd_device_register(mtd, host->ncfg->parts,
                                  host->ncfg->num_parts);
        if (res)
-               goto release_nand;
+               goto cleanup_nand;
 
        return 0;
 
-release_nand:
-       nand_release(mtd);
+cleanup_nand:
+       nand_cleanup(chip);
 release_dma:
        dma_release_channel(host->dma_chan);
 unprepare_clk: