From: Marek BehĂșn Date: Tue, 5 Oct 2021 13:55:57 +0000 (+0200) Subject: mtd: spi-nor-core: Try cleaning up in case writing BAR failed X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=36384f612da992ab485c4b7cd768a89e8c3fe8cf;p=u-boot.git mtd: spi-nor-core: Try cleaning up in case writing BAR failed 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 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 7572be5e34..6da7dc3a25 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -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);