Re: [PATCH] hwrng: imx-rngc: propagate clock enable errors

From: Frank Li

Date: Mon Aug 31 2026 - 19:29:31 EST


On Sun, Aug 30, 2026 at 09:12:53PM +0800, Pengpeng Hou wrote:
> imx_rngc_probe() reads hardware registers after enabling its clock without
> checking the result, and the runtime resume callback always reports success
> after the same unchecked operation.
>
> Propagate clock-enable errors before accessing the RNG and to the
> runtime-PM
> core on resume.

Nit: wrap to first line

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

>
> Fixes: 1d5449445bd0 ("hwrng: mx-rngc - add a driver for Freescale RNGC")
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
> ---
> 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 7693328f10564..00a21d62c79c3 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 ret;
>
> 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 = {
>
> base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
> --
> 2.50.1
>
>