[PATCH 1/2] spi: don't mark the controller suspended if queue stop fails
From: Jiawen Liu
Date: Sun Nov 29 2026 - 09:17:54 EST
spi_controller_suspend() logs and returns spi_stop_queue() failure but
still marks the controller suspended. Device PM does not call resume for
a device whose suspend callback fails, so a caller that checks the error
leaves the controller permanently marked suspended and blocks further
transfers.
Return before setting SPI_CONTROLLER_SUSPENDED when the queue does not
drain successfully.
Fixes: bef4a48f4ef7 ("spi: Fix null dereference on suspend")
Signed-off-by: Jiawen Liu <1298662399@xxxxxx>
---
drivers/spi/spi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f57f8d5c04345..747acf2d56847 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3975,12 +3975,14 @@ int spi_controller_suspend(struct spi_controller *ctlr)
/* Basically no-ops for non-queued controllers */
if (ctlr->queued) {
ret = spi_stop_queue(ctlr);
- if (ret)
+ if (ret) {
dev_err(&ctlr->dev, "queue stop failed\n");
+ return ret;
+ }
}
__spi_mark_suspended(ctlr);
- return ret;
+ return 0;
}
EXPORT_SYMBOL_GPL(spi_controller_suspend);
--
2.34.1