diff mbox

[12/52] mtd: rawnand: fsl_elbc: fix probe function error path

Message ID 20180302170400.6712-13-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() should trigger a nand_release().
The helper mtd_device_parse_register() returns an error code that should
be checked and nand_release() called accordingly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
 drivers/mtd/nand/raw/fsl_elbc_nand.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox


diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c
index d59ec6572548..fc6b18fc704c 100644
--- a/drivers/mtd/nand/raw/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c
@@ -926,13 +926,16 @@  static int fsl_elbc_nand_probe(struct platform_device *pdev)
 	/* First look for RedBoot table or partitions on the command
 	 * line, these take precedence over device tree information */
-	mtd_device_parse_register(mtd, part_probe_types, NULL,
-				  NULL, 0);
+	ret = mtd_device_parse_register(mtd, part_probe_types, NULL, NULL, 0);
+	if (ret)
+		goto release_nand;
 	printk(KERN_INFO "eLBC NAND device at 0x%llx, bank %d\n",
 	       (unsigned long long)res.start, priv->bank);
 	return 0;
+	nand_release(mtd);
 	return ret;