]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mtd: rawnand: sm_common: fix the probe function error path
authorMiquel Raynal <miquel.raynal@bootlin.com>
Sun, 25 Feb 2018 22:09:14 +0000 (23:09 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 31 Jul 2018 07:46:04 +0000 (09:46 +0200)
nand_cleanup() should be called upon error after a successful
nand_scan_tail().

Rework the error path to follow this rule .

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/sm_common.c

index 7f5044a79f0132e79e6dba05347b8b9044a8d603..8bd16639ef85ea9b73d6857e43f873c2f8dc030c 100644 (file)
@@ -192,7 +192,11 @@ int sm_register_device(struct mtd_info *mtd, int smartmedia)
        if (ret)
                return ret;
 
-       return mtd_device_register(mtd, NULL, 0);
+       ret = mtd_device_register(mtd, NULL, 0);
+       if (ret)
+               nand_cleanup(chip);
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(sm_register_device);