[PATCH u-boot-spi v3 08/10] mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase()

Marek Behún kabel at kernel.org
Tue Oct 5 15:56:04 CEST 2021


From: Marek Behún <marek.behun at nic.cz>

May it possible to interrupt the spi_nor_erase() function.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Simon Glass <sjg at chromium.org>
Tested-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
---
 drivers/mtd/spi/spi-nor-core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 451f289339..1e30b6cb27 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -929,6 +929,11 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 
 	while (len) {
 		WATCHDOG_RESET();
+		if (ctrlc()) {
+			addr_known = false;
+			ret = -EINTR;
+			goto erase_err;
+		}
 #ifdef CONFIG_SPI_FLASH_BAR
 		ret = write_bar(nor, addr);
 		if (ret < 0)
-- 
2.32.0



More information about the U-Boot mailing list