* [PATCH 2/2] spi: loongson: handle suspend failures before saving registers
[not found] <a98d03272ed5f075ecf0.1.20261129141643073183@1298662399.qq.com>
@ 2026-11-29 12:38 ` Jiawen Liu
2026-12-01 13:36 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 12:38 UTC (permalink / raw)
To: Yinbo Zhu, Mark Brown; +Cc: linux-spi, linux-kernel
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@qq.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread