Skip to content

Commit

Permalink
mtd: rawnand: sm_common: fix the probe function error path
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
miquelraynal committed Jul 31, 2018
1 parent 962c35e commit 92aa292
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/mtd/nand/raw/sm_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 92aa292

Please sign in to comment.