[PATCH u-boot-spi v3 01/10] mtd: spi-nor-core: Try cleaning up in case writing BAR failed
    Marek Behún 
    kabel at kernel.org
       
    Tue Oct  5 15:55:57 CEST 2021
    
    
  
From: Marek Behún <marek.behun at nic.cz>
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 at nic.cz>
Reviewed-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>
Reviewed-by: Pratyush Yadav <p.yadav at ti.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
---
 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 f1b4e5ea8e..d1e2bb47f7 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);
 
-- 
2.32.0
    
    
More information about the U-Boot
mailing list