diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-03-21 14:01:42 +0100 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-03-29 09:38:18 +0200 |
commit | 5826b8802a970d2b0aaf097951de42040ee32480 (patch) | |
tree | 1e72dca6c76548a953d1c253e92d5e4b031835cf /drivers/mtd/nand/raw/brcmnand | |
parent | mtd: rawnand: sunxi: Stop supporting ECC_HW_SYNDROME mode (diff) | |
download | linux-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>
Diffstat (limited to 'drivers/mtd/nand/raw/brcmnand')
-rw-r--r-- | drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 |
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, |