From: Yuho Choi <dbgh9129@gmail.com>
To: olivia@selenic.com, herbert@gondor.apana.org.au,
Frank.Li@nxp.com, s.hauer@pengutronix.de
Cc: kernel@pengutronix.de, festevam@gmail.com,
linux-crypto@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dakr@kernel.org,
o-takashi@sakamocchi.jp, bhelgaas@google.com,
Yuho Choi <dbgh9129@gmail.com>
Subject: [PATCH v1] hwrng: imx-rngc: Disable clock on registration failure
Date: Sun, 2 Aug 2026 18:22:59 -0400 [thread overview]
Message-ID: <20260802222259.577200-1-dbgh9129@gmail.com> (raw)
The RNGC clock is enabled manually before runtime PM is configured. If
devm_hwrng_register() fails, probe returns without disabling the clock.
The devm_pm_runtime_enable() cleanup only disables runtime PM and does not
call imx_rngc_suspend().
Disable the clock before returning from this failure path.
Fixes: 7a96a64e8689 ("hwrng: imx-rngc - add runtime pm")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
drivers/char/hw_random/imx-rngc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 28c56c2d1bf6..a2db26d7f790 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -313,8 +313,10 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
devm_pm_runtime_enable(&pdev->dev);
ret = devm_hwrng_register(&pdev->dev, &rngc->rng);
- if (ret)
+ if (ret) {
+ clk_disable_unprepare(rngc->clk);
return dev_err_probe(&pdev->dev, ret, "hwrng registration failed\n");
+ }
dev_info(&pdev->dev,
"Freescale RNG%c registered (HW revision %d.%02d)\n",
--
2.43.0
next reply other threads:[~2026-08-02 22:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 22:22 Yuho Choi [this message]
2026-08-07 7:25 ` [PATCH v1] hwrng: imx-rngc: Disable clock on registration failure Martin Kaiser
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=20260802222259.577200-1-dbgh9129@gmail.com \
--to=dbgh9129@gmail.com \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=dakr@kernel.org \
--cc=festevam@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=olivia@selenic.com \
--cc=s.hauer@pengutronix.de \
/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