From: "Li Youhong" <dayou5941@163.com>
To: sunny.luo@amlogic.com, xianwei.zhao@amlogic.com, broonie@kernel.org
Cc: linux-amlogic@lists.infradead.org, linux-spi@vger.kernel.org,
Li Youhong <liyouhong@kylinos.cn>
Subject: [PATCH] spi: amlogic-spisg: check clk_prepare_enable() return value
Date: Mon, 31 Aug 2026 17:45:53 +0800 [thread overview]
Message-ID: <20260831094553.2247003-1-dayou5941@163.com> (raw)
From: Li Youhong <liyouhong@kylinos.cn>
The driver ignored clk_prepare_enable() failures for sclk during
probe and for core/sclk during runtime resume. Propagate the errors
and, on resume, disable core if enabling sclk fails, so probe/resume
do not continue with clocks disabled or report success falsely.
Fixes: cef9991e04ae ("spi: Add Amlogic SPISG driver")
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
drivers/spi/spi-amlogic-spisg.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-amlogic-spisg.c b/drivers/spi/spi-amlogic-spisg.c
index afc8af04638d..71b73df1b5ca 100644
--- a/drivers/spi/spi-amlogic-spisg.c
+++ b/drivers/spi/spi-amlogic-spisg.c
@@ -704,7 +704,9 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)
return PTR_ERR(spisg->sclk);
}
- clk_prepare_enable(spisg->sclk);
+ ret = clk_prepare_enable(spisg->sclk);
+ if (ret)
+ return ret;
return 0;
}
@@ -841,9 +843,18 @@ static int spisg_suspend_runtime(struct device *dev)
static int spisg_resume_runtime(struct device *dev)
{
struct spisg_device *spisg = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_prepare_enable(spisg->core);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(spisg->sclk);
+ if (ret) {
+ clk_disable_unprepare(spisg->core);
+ return ret;
+ }
- clk_prepare_enable(spisg->core);
- clk_prepare_enable(spisg->sclk);
pinctrl_pm_select_default_state(&spisg->pdev->dev);
return 0;
--
2.25.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next reply other threads:[~2026-08-31 9:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 9:45 Li Youhong [this message]
2026-08-31 10:01 ` sashiko-bot
2026-09-09 13:27 ` Mark Brown
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=20260831094553.2247003-1-dayou5941@163.com \
--to=dayou5941@163.com \
--cc=broonie@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--cc=sunny.luo@amlogic.com \
--cc=xianwei.zhao@amlogic.com \
/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®