@@ -1065,12 +1065,16 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
/* 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;
dev_info(priv->dev, "IFC NAND device at 0x%llx, bank %d\n",
(unsigned long long)res.start, priv->bank);
return 0;
+release_nand:
+ nand_release(mtd);
err:
fsl_ifc_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_ifc_nand.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)