From: Jiawen Liu <1298662399@qq.com>
To: Deepak Saxena <dsaxena@plexity.net>,
Olivia Mackall <olivia@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] char: omap-rng: fix runtime PM cleanup
Date: Tue, 18 Aug 2026 17:28:48 +0400 [thread overview]
Message-ID: <tencent_1DBD00BAFF365506D40F166D40DEE8F63B0A@qq.com> (raw)
Clean up runtime PM on deferred probe.
omap_rng_probe leaks runtime PM state if devm_clk_get returns
-EPROBE_DEFER after pm_runtime_resume_and_get succeeds. Direct return
skips put/disable.
Route -EPROBE_DEFER paths through resource-matched runtime PM cleanup in
omap_rng_probe.
Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -459,8 +459,10 @@
}
priv->clk = devm_clk_get(&pdev->dev, NULL);
- if (PTR_ERR(priv->clk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
+ if (PTR_ERR(priv->clk) == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto err_pm_runtime;
+ }
if (!IS_ERR(priv->clk)) {
ret = clk_prepare_enable(priv->clk);
if (ret) {
@@ -471,8 +473,10 @@
}
priv->clk_reg = devm_clk_get(&pdev->dev, "reg");
- if (PTR_ERR(priv->clk_reg) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
+ if (PTR_ERR(priv->clk_reg) == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto err_pm_runtime_clock_1;
+ }
if (!IS_ERR(priv->clk_reg)) {
ret = clk_prepare_enable(priv->clk_reg);
if (ret) {
@@ -497,6 +501,16 @@
return 0;
+err_pm_runtime_clock_1:
+ if (!IS_ERR(priv->clk))
+ clk_disable_unprepare(priv->clk);
+ goto err_pm_runtime;
+
+err_pm_runtime:
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ goto err_ioremap;
+
err_register:
priv->base = NULL;
pm_runtime_put_sync(&pdev->dev);
next reply other threads:[~2026-08-18 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:28 Jiawen Liu [this message]
2026-09-04 9:46 ` [PATCH] char: omap-rng: fix runtime PM cleanup Herbert Xu
2026-09-04 10:26 ` [PATCH v2] " Jiawen Liu
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_1DBD00BAFF365506D40F166D40DEE8F63B0A@qq.com \
--to=1298662399@qq.com \
--cc=dsaxena@plexity.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olivia@selenic.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