[PATCH] mtd: spi-nor: Ensure operation completion before shutdown

From: Md Sadre Alam
Date: Thu Oct 12 2023 - 01:52:26 EST


Ensure that there are no pending spi operation inprogress
when system halts.

Signed-off-by: Md Sadre Alam <quic_mdalam@xxxxxxxxxxx>
---
drivers/mtd/spi-nor/core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..adc4d2c68695 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3690,6 +3690,9 @@ static void spi_nor_shutdown(struct spi_mem *spimem)
{
struct spi_nor *nor = spi_mem_get_drvdata(spimem);

+ /* Ensure no pending spi operation in progress */
+ spi_nor_wait_till_ready(nor);
+
spi_nor_restore(nor);
}

--
2.34.1