From: Jiawen Liu <1298662399@qq.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] spi: dw-mmio: handle clock enable failures during resume
Date: Sun, 29 Nov 2026 16:25:56 +0400 [thread overview]
Message-ID: <tencent_0DA73C40B35F904A82FAD3A21DC836DD4407@qq.com> (raw)
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
reply other threads:[~2026-11-29 14:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_0DA73C40B35F904A82FAD3A21DC836DD4407@qq.com \
--to=1298662399@qq.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®