From: Marek Behún <[email protected]> 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 <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Jagan Teki <[email protected]> Tested-by: Masami Hiramatsu <[email protected]> --- drivers/mtd/spi/spi-nor-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index d5d905fa5a..529e7e9178 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -927,7 +927,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); -- 2.32.0

