[PATCH v4 1/2] hwrng: imx-rngc: Use optional clock

Martin Kaiser martin at kaiser.cx
Wed Nov 26 12:30:07 PST 2025


Thus wrote Jean-Michel Hautbois via B4 Relay (devnull+jeanmichel.hautbois.yoseli.org at kernel.org):

> From: Jean-Michel Hautbois <jeanmichel.hautbois at yoseli.org>

> Change devm_clk_get() to devm_clk_get_optional() to support platforms
> where the RNG clock is always enabled and not exposed via the clock
> framework (such as ColdFire MCF54418).

> Reviewed-by: Frank Li <Frank.Li at nxp.com>
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at yoseli.org>
> ---
>  drivers/char/hw_random/imx-rngc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
> index 241664a9b5d9..d6a847e48339 100644
> --- a/drivers/char/hw_random/imx-rngc.c
> +++ b/drivers/char/hw_random/imx-rngc.c
> @@ -259,7 +259,7 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
>  	if (IS_ERR(rngc->base))
>  		return PTR_ERR(rngc->base);

> -	rngc->clk = devm_clk_get(&pdev->dev, NULL);
> +	rngc->clk = devm_clk_get_optional(&pdev->dev, NULL);
>  	if (IS_ERR(rngc->clk))
>  		return dev_err_probe(&pdev->dev, PTR_ERR(rngc->clk), "Cannot get rng_clk\n");

The clock is not optional on a standard imx25 system. If it's missing in the
device tree, the rngb will not work and we should not load the driver.

Should we call devm_clk_get or devm_clk_get_optional, depending on the
detected device?

Best regards,
Martin



More information about the linux-arm-kernel mailing list