summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-21 14:01:53 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-29 09:38:20 +0200
commit0eaa879be623f5e209e79a40f5e281f9c5c9170b (patch)
tree84e836d9cff6581d6acb3a3fb8f65ca563b19dcc /drivers/mtd
parent5a3e8cde101209edb962ed42091db257f9f5ce5c (diff)
downloadlinux-0eaa879be623f5e209e79a40f5e281f9c5c9170b.tar.bz2
mtd: rawnand: tango: 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. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/raw/tango_nand.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/tango_nand.c b/drivers/mtd/nand/raw/tango_nand.c
index c5bee00b7f5e..f54518ffb36a 100644
--- a/drivers/mtd/nand/raw/tango_nand.c
+++ b/drivers/mtd/nand/raw/tango_nand.c
@@ -591,8 +591,10 @@ static int chip_init(struct device *dev, struct device_node *np)
tchip->bb_cfg = BB_CFG(mtd->writesize, BBM_SIZE);
err = mtd_device_register(mtd, NULL, 0);
- if (err)
+ if (err) {
+ nand_cleanup(chip);
return err;
+ }
nfc->chips[cs] = tchip;