[PATCH 2/2] spi: loongson: handle suspend failures before saving registers
From: Jiawen Liu
Date: Sun Nov 29 2026 - 09:19:00 EST
loongson_spi_suspend() ignores a failure to stop the controller queue,
saves registers, and reports successful suspend. Queued I/O can still be
active, and saving PARA can overwrite the value needed by the in-flight
message cleanup.
Propagate a queue-stop failure before reading any registers. The SPI core
now leaves the controller usable when that attempt fails.
Fixes: 6c7a864007b6 ("spi: loongson: add bus driver for the loongson spi controller")
Signed-off-by: Jiawen Liu <1298662399@xxxxxx>
---
drivers/spi/spi-loongson-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-loongson-core.c b/drivers/spi/spi-loongson-core.c
index 6ba7c56b1bdda..d6f644a00a9bf 100644
--- a/drivers/spi/spi-loongson-core.c
+++ b/drivers/spi/spi-loongson-core.c
@@ -233,9 +233,12 @@ static int loongson_spi_suspend(struct device *dev)
{
struct loongson_spi *loongson_spi;
struct spi_controller *controller;
+ int ret;
controller = dev_get_drvdata(dev);
- spi_controller_suspend(controller);
+ ret = spi_controller_suspend(controller);
+ if (ret)
+ return ret;
loongson_spi = spi_controller_get_devdata(controller);
--
2.34.1