From: Martin Kaiser <martin@kaiser.cx>
To: Yuho Choi <dbgh9129@gmail.com>
Cc: olivia@selenic.com, herbert@gondor.apana.org.au,
Frank.Li@nxp.com, s.hauer@pengutronix.de, 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
Subject: Re: [PATCH v1] hwrng: imx-rngc: Disable clock on registration failure
Date: Fri, 7 Aug 2026 09:25:32 +0200 [thread overview]
Message-ID: <anWIbJ_YNM8C-tu3@akranes.kaiser.cx> (raw)
In-Reply-To: <20260802222259.577200-1-dbgh9129@gmail.com>
Thus wrote Yuho Choi (dbgh9129@gmail.com):
> 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
Good catch, thanks.
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
prev parent reply other threads:[~2026-08-07 7:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 22:22 [PATCH v1] hwrng: imx-rngc: Disable clock on registration failure Yuho Choi
2026-08-07 7:25 ` Martin Kaiser [this message]
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=anWIbJ_YNM8C-tu3@akranes.kaiser.cx \
--to=martin@kaiser.cx \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=dakr@kernel.org \
--cc=dbgh9129@gmail.com \
--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