]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: omap2: fix the probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 21 Mar 2018 13:01:51 +0000 (14:01 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Thu, 29 Mar 2018 07:38:20 +0000 (09:38 +0200)
An error after nand_scan_tail() should trigger a nand_cleanup().
The helper mtd_device_parse_register() returns an error code that should
be checked and nand_cleanup() called accordingly.

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

index 8cdf7d3d8fa7b113cf2b10f6c85f89c5273c0f7e..e50c64adc3c842bfa7cc6f68db08245a92f927ea 100644 (file)
@@ -2263,12 +2263,15 @@ static int omap_nand_probe(struct platform_device *pdev)
 
        err = mtd_device_register(mtd, NULL, 0);
        if (err)
-               goto return_error;
+               goto cleanup_nand;
 
        platform_set_drvdata(pdev, mtd);
 
        return 0;
 
+cleanup_nand:
+       nand_cleanup(nand_chip);
+
 return_error:
        if (!IS_ERR_OR_NULL(info->dma))
                dma_release_channel(info->dma);