[PATCH 31/52] mtd: rawnand: omap2: fix the probe function error path
Miquel Raynal
miquel.raynal at bootlin.com
Fri Mar 2 09:03:39 PST 2018
An error after nand_scan_tail() call should trigger a nand_release()
call. This is rightly handled in the remove function, but not in the
probe function.
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
drivers/mtd/nand/raw/omap2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
index 8cdf7d3d8fa7..88c43334d777 100644
--- a/drivers/mtd/nand/raw/omap2.c
+++ b/drivers/mtd/nand/raw/omap2.c
@@ -2263,12 +2263,14 @@ static int omap_nand_probe(struct platform_device *pdev)
err = mtd_device_register(mtd, NULL, 0);
if (err)
- goto return_error;
+ goto release_nand;
platform_set_drvdata(pdev, mtd);
return 0;
+release_nand:
+ nand_release(mtd);
return_error:
if (!IS_ERR_OR_NULL(info->dma))
dma_release_channel(info->dma);
--
2.14.1
More information about the linux-arm-kernel
mailing list