aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-21 14:01:43 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-29 09:38:18 +0200
commita446c998ff0cd49fa8023f607e9fc15ce45ec576 (patch)
tree7b8d6677d605ba4c2aca81c2c7c8cb30fd67b2d9 /drivers/mtd
parentmtd: rawnand: brcmnand: fix probe function error path (diff)
downloadlinux-dev-a446c998ff0cd49fa8023f607e9fc15ce45ec576.tar.xz
linux-dev-a446c998ff0cd49fa8023f607e9fc15ce45ec576.zip
mtd: rawnand: cafe: fix 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')
-rw-r--r--drivers/mtd/nand/raw/cafe_nand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
index 3c1b6a3786b2..d8c8c9d1e640 100644
--- a/drivers/mtd/nand/raw/cafe_nand.c
+++ b/drivers/mtd/nand/raw/cafe_nand.c
@@ -774,10 +774,14 @@ static int cafe_nand_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, mtd);
mtd->name = "cafe_nand";
- mtd_device_parse_register(mtd, part_probes, NULL, NULL, 0);
+ err = mtd_device_parse_register(mtd, part_probes, NULL, NULL, 0);
+ if (err)
+ goto out_cleanup_nand;
goto out;
+ out_cleanup_nand:
+ nand_cleanup(&cafe->nand);
out_free_dma:
dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr);
out_irq: