summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-04-21 20:00:37 +0200
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-04-29 08:56:43 +0200
commit682cae27b1da0554496983a356b82b4d87540c48 (patch)
tree46688d7baffa74bfce58d12551dbde1ef3b4cc5f /drivers/mtd
parent43fab011e93fea0699c2e79a7e561b8f095906f3 (diff)
downloadlinux-stable-682cae27b1da0554496983a356b82b4d87540c48.tar.gz
linux-stable-682cae27b1da0554496983a356b82b4d87540c48.tar.bz2
linux-stable-682cae27b1da0554496983a356b82b4d87540c48.zip
mtd: rawnand: fsmc: fix the probe function error path
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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/fsmc_nand.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 35af3890ddba..f4a5a317d4ae 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -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);