From: Martin Kaiser <martin@kaiser.cx>
To: Li Youhong <dayou5941@163.com>
Cc: olivia@selenic.com, herbert@gondor.apana.org.au,
linux-crypto@vger.kernel.org, imx@lists.linux.dev,
Li Youhong <liyouhong@kylinos.cn>
Subject: Re: [PATCH] hwrng: imx-rngc: check clk_prepare_enable() return value
Date: Tue, 1 Sep 2026 15:37:21 +0200 [thread overview]
Message-ID: <apbVER_TVhLLqA9X@akranes.kaiser.cx> (raw)
In-Reply-To: <20260828025423.2149304-1-dayou5941@163.com>
Thus wrote Li Youhong (dayou5941@163.com):
> From: Li Youhong <liyouhong@kylinos.cn>
> The driver ignored clk_prepare_enable() failures during probe and
> resume. If enabling the RNG clock fails, subsequent register accesses
> or resume after system sleep may not work while the driver still reports
> success.
> Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
> ---
> drivers/char/hw_random/imx-rngc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
> index 7693328f1056..0545a1870146 100644
> --- a/drivers/char/hw_random/imx-rngc.c
> +++ b/drivers/char/hw_random/imx-rngc.c
> @@ -266,7 +266,9 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
> - clk_prepare_enable(rngc->clk);
> + ret = clk_prepare_enable(rngc->clk);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Cannot enable rng_clk\n");
> ver_id = readl(rngc->base + RNGC_VER_ID);
> rng_type = FIELD_GET(RNG_TYPE, ver_id);
> @@ -338,9 +340,7 @@ static int imx_rngc_resume(struct device *dev)
> {
> struct imx_rngc *rngc = dev_get_drvdata(dev);
> - clk_prepare_enable(rngc->clk);
> -
> - return 0;
> + return clk_prepare_enable(rngc->clk);
> }
> static const struct dev_pm_ops imx_rngc_pm_ops = {
> --
> 2.25.1
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
prev parent reply other threads:[~2026-09-01 14:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 2:54 [PATCH] hwrng: imx-rngc: check clk_prepare_enable() return value Li Youhong
2026-08-28 19:44 ` Frank Li
2026-09-01 13:37 ` 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=apbVER_TVhLLqA9X@akranes.kaiser.cx \
--to=martin@kaiser.cx \
--cc=dayou5941@163.com \
--cc=herbert@gondor.apana.org.au \
--cc=imx@lists.linux.dev \
--cc=linux-crypto@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--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