Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
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: Fri, 28 Aug 2026 14:44:32 -0500	[thread overview]
Message-ID: <apHlIGM3_GHf86fK@SMW015318> (raw)
In-Reply-To: <20260828025423.2149304-1-dayou5941@163.com>

On Fri, Aug 28, 2026 at 10:54:23AM +0800, Li Youhong wrote:
>
> 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>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  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 19:44 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 [this message]
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=apHlIGM3_GHf86fK@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --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