diff mbox

[31/52] mtd: rawnand: omap2: fix the probe function error path

Message ID 20180302170400.6712-32-miquel.raynal@bootlin.com (mailing list archive)
State New, archived
Headers show

Commit Message

Miquel Raynal March 2, 2018, 5:03 p.m. UTC
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@bootlin.com>
 drivers/mtd/nand/raw/omap2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox


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;
+	nand_release(mtd);
 	if (!IS_ERR_OR_NULL(info->dma))