Skip to contentSkip to conversation

mtd: spinand: Fix the error/cleanup path in spinand_init()

PATCH Applied Boris Brezillon 2 participants 3 messages Jan 24, 2019 – Jan 31, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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().

Fixes 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
---
 drivers/mtd/nand/spi/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/core.c +2 -2
index 8bf37da19663..fa87ae28cdfe 100644
@@ -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
maintainer Acked-by on v1 1/1
#1 lore raw

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")
---
 drivers/mtd/nand/spi/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/core.c +0 -0
index 8bf37da19663..fa87ae28cdfe 100644
@@ -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

author Applied
#2 lore raw
In reply to Boris Brezillon
Quoted 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")

Applied to http://git.infradead.org/linux-mtd.git mtd/fixes.

Boris