Linux cryptographic layer development
 help / color / mirror / Atom feed
From: "Li Youhong" <dayou5941@163.com>
To: olivia@selenic.com, herbert@gondor.apana.org.au
Cc: linux-crypto@vger.kernel.org, imx@lists.linux.dev,
	Li Youhong <liyouhong@kylinos.cn>
Subject: [PATCH] hwrng: imx-rngc: check clk_prepare_enable() return value
Date: Fri, 28 Aug 2026 10:54:23 +0800	[thread overview]
Message-ID: <20260828025423.2149304-1-dayou5941@163.com> (raw)

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


             reply	other threads:[~2026-08-28  2:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  2:54 Li Youhong [this message]
2026-08-28 19:44 ` [PATCH] hwrng: imx-rngc: check clk_prepare_enable() return value Frank Li
2026-09-01 13:37 ` 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=20260828025423.2149304-1-dayou5941@163.com \
    --to=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