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 <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>
This commit is contained in:
Marek Behún 2021-10-05 15:55:57 +02:00 committed by Jagan Teki
parent e66c6f1027
commit 36384f612d

View file

@ -929,7 +929,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
#ifdef CONFIG_SPI_FLASH_BAR #ifdef CONFIG_SPI_FLASH_BAR
ret = write_bar(nor, addr); ret = write_bar(nor, addr);
if (ret < 0) if (ret < 0)
return ret; goto erase_err;
#endif #endif
write_enable(nor); write_enable(nor);