summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-21 14:01:42 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-29 09:38:18 +0200
commit5826b8802a970d2b0aaf097951de42040ee32480 (patch)
tree1e72dca6c76548a953d1c253e92d5e4b031835cf
parentmtd: rawnand: sunxi: Stop supporting ECC_HW_SYNDROME mode (diff)
downloadlinux-5826b8802a970d2b0aaf097951de42040ee32480.tar.xz
linux-5826b8802a970d2b0aaf097951de42040ee32480.zip
mtd: rawnand: brcmnand: fix probe function error path
An error after nand_scan_tail() should trigger a nand_cleanup(). The helper mtd_device_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>
-rw-r--r--drivers/mtd/nand/raw/brcmnand/brcmnand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index c28fd2bc1a84..1306aaa7a8bf 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -2297,7 +2297,11 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
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;
}
static void brcmnand_save_restore_cs_config(struct brcmnand_host *host,