mtd: rawnand: fsl_ifc: fix probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sat, 21 Apr 2018 18:00:35 +0000 (20:00 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Sun, 29 Apr 2018 06:56:43 +0000 (08:56 +0200)
commitacfc33091f7a5118a7c6d899162e9d9cee72b17a
treec984431dc008bbb8340373614d0c9f8828a36837
parent39b77c586e179db03d8cdbc448d4a0fc22f8b13a
mtd: rawnand: fsl_ifc: fix probe function error path

An error after nand_scan_tail() should trigger a nand_cleanup().
The helper mtd_device_parse_register() returns an error code that should
be checked and nand_cleanup() called accordingly.

However, in this driver, fsl_ifc_chip_remove() which is called upon
error already triggers a nand_release() which is wrong, because a
nand_release() should be triggered only if an mtd_register() succeeded.

Move the nand_release() call out of the fsl_ifc_chip_remove() and put it
back in the *_remove() hook.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
drivers/mtd/nand/raw/fsl_ifc_nand.c