]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: spi-nor-core: Try cleaning up in case writing BAR failed
authorMarek Behún <marek.behun@nic.cz>
Tue, 5 Oct 2021 13:55:57 +0000 (15:55 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Sat, 23 Oct 2021 10:17:33 +0000 (15:47 +0530)
Use the cleanup codepath of spi_nor_erase() also in the event of failure
of writing the BAR register.

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 7572be5e34f38e4a79e5134cc099c340093d1239..6da7dc3a256e2a0ab724f16b5b892e522e0f9fd1 100644 (file)
@@ -929,7 +929,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 #ifdef CONFIG_SPI_FLASH_BAR
                ret = write_bar(nor, addr);
                if (ret < 0)
-                       return ret;
+                       goto erase_err;
 #endif
                write_enable(nor);