mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: dw-mmio: handle clock enable failures during resume
@ 2026-11-29 12:25 Jiawen Liu
  0 siblings, 0 replies; only message in thread
From: Jiawen Liu @ 2026-11-29 12:25 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, linux-kernel

dw_spi_mmio_resume() ignores failures from re-enabling the controller and
register-interface clocks after system suspend. It can then deassert reset
and access controller registers without the required clocks, and report a
successful resume even though the hardware is unusable.

Propagate the controller-clock error directly. If the interface clock
fails, release the controller clock before returning so the partially
restored state is unwound.

Fixes: a8b6e3738c87 ("spi: dw-mmio: support suspend/resume")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/spi/spi-dw-mmio.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index dd703c1e56c51..66a48089f21d0 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -472,8 +472,15 @@ static int dw_spi_mmio_resume(struct device *dev)
 	struct dw_spi_mmio *dwsmmio = dev_get_drvdata(dev);
 	int ret;
 
-	clk_prepare_enable(dwsmmio->clk);
-	clk_prepare_enable(dwsmmio->pclk);
+	ret = clk_prepare_enable(dwsmmio->clk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(dwsmmio->pclk);
+	if (ret) {
+		clk_disable_unprepare(dwsmmio->clk);
+		return ret;
+	}
 
 	reset_control_deassert(dwsmmio->rstc);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 12:25 [PATCH] spi: dw-mmio: handle clock enable failures during resume Jiawen Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®