summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-21 14:01:52 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-29 09:38:20 +0200
commit5a3e8cde101209edb962ed42091db257f9f5ce5c (patch)
tree97fe538637549be93a306af41658e661e9e60b9d /drivers/mtd/nand
parent122bb3cb8b009aaa19fd8b09df8028ba8d49c043 (diff)
downloadop-kernel-dev-5a3e8cde101209edb962ed42091db257f9f5ce5c.zip
op-kernel-dev-5a3e8cde101209edb962ed42091db257f9f5ce5c.tar.gz
mtd: rawnand: sh_flctl: fix the probe function error path
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>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/sh_flctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/sh_flctl.c b/drivers/mtd/nand/raw/sh_flctl.c
index 7a740d5..c7abcef 100644
--- a/drivers/mtd/nand/raw/sh_flctl.c
+++ b/drivers/mtd/nand/raw/sh_flctl.c
@@ -1214,9 +1214,13 @@ static int flctl_probe(struct platform_device *pdev)
goto err_chip;
ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts);
+ if (ret)
+ goto cleanup_nand;
return 0;
+cleanup_nand:
+ nand_cleanup(nand);
err_chip:
flctl_release_dma(flctl);
pm_runtime_disable(&pdev->dev);
OpenPOWER on IntegriCloud