From 1fd5e67595367126c9f76b3f0c47db21523665c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Tue, 5 Oct 2021 15:56:04 +0200 Subject: [PATCH] mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit May it possible to interrupt the spi_nor_erase() function. Signed-off-by: Marek Behún Reviewed-by: Simon Glass Tested-by: Masami Hiramatsu --- 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 2c71866bca..a85759967b 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.39.5