aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/sh_flctl.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-21 09:01:52 -0400
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-29 03:38:20 -0400
commit5a3e8cde101209edb962ed42091db257f9f5ce5c (patch)
tree97fe538637549be93a306af41658e661e9e60b9d /drivers/mtd/nand/raw/sh_flctl.c
parent122bb3cb8b009aaa19fd8b09df8028ba8d49c043 (diff)
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/raw/sh_flctl.c')
-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 7a740d583866..c7abceffcc40 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)
1214 goto err_chip; 1214 goto err_chip;
1215 1215
1216 ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts); 1216 ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts);
1217 if (ret)
1218 goto cleanup_nand;
1217 1219
1218 return 0; 1220 return 0;
1219 1221
1222cleanup_nand:
1223 nand_cleanup(nand);
1220err_chip: 1224err_chip:
1221 flctl_release_dma(flctl); 1225 flctl_release_dma(flctl);
1222 pm_runtime_disable(&pdev->dev); 1226 pm_runtime_disable(&pdev->dev);