Message ID | 20180302170400.6712-5-miquel.raynal@bootlin.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index c28fd2bc1a84..844c84987f49 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_release(mtd); + + return ret; } static void brcmnand_save_restore_cs_config(struct brcmnand_host *host,
An error after nand_scan_tail() should trigger a nand_release(). The helper mtd_device_register() returns an error code that should be checked and nand_release() called accordingly. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)