summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2021-10-05 15:55:58 +0200
committerJagan Teki <jagan@amarulasolutions.com>2021-10-23 15:47:33 +0530
commit5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60 (patch)
tree36ca5f7b033dbbf99b2b97efc2daba2589ef9d45 /drivers/mtd/spi
parent36384f612da992ab485c4b7cd768a89e8c3fe8cf (diff)
downloadu-boot-5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60.tar.gz
u-boot-5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60.tar.bz2
u-boot-5ea6dccee45ab941cfc78fbbfd9600ef24c5ca60.zip
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 <marek.behun@nic.cz> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/spi-nor-core.c4
1 files changed, 3 insertions, 1 deletions
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)