]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: fsmc: fix the probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sat, 21 Apr 2018 18:00:37 +0000 (20:00 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 29 Apr 2018 06:56:43 +0000 (08:56 +0200)
An error after nand_scan_tail() should trigger a nand_cleanup().

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

index 35af3890ddba8a9b08843d5a44462814b533b097..f4a5a317d4ae41abced010018817ac2be16b8ed4 100644 (file)
@@ -1123,13 +1123,15 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
        mtd->name = "nand";
        ret = mtd_device_register(mtd, NULL, 0);
        if (ret)
-               goto release_dma_write_chan;
+               goto cleanup_nand;
 
        platform_set_drvdata(pdev, host);
        dev_info(&pdev->dev, "FSMC NAND driver registration successful\n");
 
        return 0;
 
+cleanup_nand:
+       nand_cleanup(nand);
 release_dma_write_chan:
        if (host->mode == USE_DMA_ACCESS)
                dma_release_channel(host->write_dma_chan);