diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-02-25 23:09:14 +0100 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-07-31 09:46:04 +0200 |
commit | 92aa292d2e47be6210c0ba6074fc0ddfc02f7856 (patch) | |
tree | 1db4ca3b8f6d6e72a03ff1a1143afdfd737cbeec /drivers/mtd/nand | |
parent | 962c35ef1e68346ae9c9691e14670f0ee96dcdbd (diff) |
mtd: rawnand: sm_common: fix the probe function error path
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>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/raw/sm_common.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/sm_common.c b/drivers/mtd/nand/raw/sm_common.c index 7f5044a79f01..8bd16639ef85 100644 --- a/drivers/mtd/nand/raw/sm_common.c +++ b/drivers/mtd/nand/raw/sm_common.c @@ -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); |