From 5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Tue, 5 Oct 2021 15:55:58 +0200 Subject: [PATCH] mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The spi_nor_erase() function does not check return value of the write_enable() call. Fix this. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Reviewed-by: Pratyush Yadav Tested-by: Masami Hiramatsu --- 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 6da7dc3a25..6231ec5ce5 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -931,7 +931,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.39.5