@@ -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;
+release_nand:
+ nand_release(mtd);
err:
fsl_elbc_chip_remove(priv);
return ret;
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(-)