]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()
authorMarek Behún <marek.behun@nic.cz>
Tue, 5 Oct 2021 13:55:58 +0000 (15:55 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Sat, 23 Oct 2021 10:17:33 +0000 (15:47 +0530)
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>
drivers/mtd/spi/spi-nor-core.c

index 6da7dc3a256e2a0ab724f16b5b892e522e0f9fd1..6231ec5ce58322c8d65d06d33a4d91fe44e6b4e0 100644 (file)
@@ -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)