From: Marek BehĂșn Date: Tue, 5 Oct 2021 13:55:58 +0000 (+0200) Subject: mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase() X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60;p=u-boot.git mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase() 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 --- 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)