mtd: spinand: Fix the error/cleanup path in spinand_init()
authorBoris Brezillon <bbrezillon@kernel.org>
Thu, 24 Jan 2019 14:46:54 +0000 (15:46 +0100)
committerBoris Brezillon <bbrezillon@kernel.org>
Thu, 31 Jan 2019 11:31:02 +0000 (12:31 +0100)
The manufacturer specific initialization has already been done when
block unlocking takes place, and if anything goes wrong during this
procedure we should call spinand_manufacturer_cleanup().

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/spi/core.c

index 8bf37da1966315715c0dcfa5eaf6bef7c51ed520..fa87ae28cdfecd21fb6fb435fac35047a3b37325 100644 (file)
@@ -1016,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand)
        for (i = 0; i < nand->memorg.ntargets; i++) {
                ret = spinand_select_target(spinand, i);
                if (ret)
-                       goto err_free_bufs;
+                       goto err_manuf_cleanup;
 
                ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
                if (ret)
-                       goto err_free_bufs;
+                       goto err_manuf_cleanup;
        }
 
        ret = nanddev_init(nand, &spinand_ops, THIS_MODULE);