mtd: spinand: Fix the error/cleanup path in spinand_init()
Subsystems (3)
PATCH 1/1 mtd: spinand: Fix the error/cleanup path in spinand_init()
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().
--- drivers/mtd/nand/spi/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/core.c +2 -2
@@ -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 );
Signature · 1 line
2.17.1
Hi Boris,
Boris Brezillon <[email protected]> wrote on Thu, 24 Jan 2019 15:46:54 +0100:
Quoted 19 lines
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 <[email protected]>Signed-off-by Boris Brezillon <[email protected]>--- drivers/mtd/nand/spi/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mtd/nand/spi/core.c +0
-0@@ -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)
drivers/mtd/nand/spi/core.c static int spinand_init(struct spinand_device *spinand) · line 1026
Quoted 10 lines
drivers/mtd/nand/spi/core.c +2
-2- 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 );
Thanks,
Miquèl
Boris Brezillon
AppliedQuoted 8 lines · Boris Brezillon
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 <[email protected]>Signed-off-by Boris Brezillon <[email protected]>Acked-by Miquel Raynal <[email protected]>
Applied to http://git.infradead.org/linux-mtd.git mtd/fixes.
Boris