Message ID | 20210714235109.25228-2-marek.behun@nic.cz |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | Fix `mtd erase` when used with mtdpart | expand |
On Wed, 14 Jul 2021 at 17:51, Marek Behún <marek.behun@nic.cz> wrote: > > 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> > Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> > --- > drivers/mtd/spi/spi-nor-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Simon Glass <sjg@chromium.org>
On Thu, Jul 15, 2021 at 5:21 AM Marek Behún <marek.behun@nic.cz> wrote: > > 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> > Tested-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> > --- Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 99e2f16349..7ce8dc5502 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);