[PATCH RESEND u-boot-spi 2/8] mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()

Marek Behún marek.behun at nic.cz
Thu Jul 15 01:51:03 CEST 2021


The spi_nor_erase() function does not check return value of the
write_enable() call. Fix this.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
Tested-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
---
 drivers/mtd/spi/spi-nor-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 7ce8dc5502..8fd1d684f2 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -929,7 +929,9 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 		if (ret < 0)
 			goto erase_err;
 #endif
-		write_enable(nor);
+		ret = write_enable(nor);
+		if (ret < 0)
+			goto erase_err;
 
 		ret = spi_nor_erase_sector(nor, addr);
 		if (ret < 0)
-- 
2.31.1



More information about the U-Boot mailing list