[PATCH] clk: qcom: Fix invalid usage of dev_read_addr

Casey Connolly casey.connolly at linaro.org
Tue May 26 16:53:10 CEST 2026


Hi Francois,

On 25/05/2026 22:46, Francois Berder wrote:
> dev_read_addr returns a fdt_addr_t and not a pointer type.
> Replace dev_read_addr by dev_read_addr_ptr.
> Check that base pointer is valid.

Is there something in particular that motivated this change? The patch
is fine but basically comes across as noise since this error condition
will basically never be hit in practise (the DT would have to be wrong
in a really obvious basic way) and if it were the clock driver would
fail to probe and we'd crash hard.

I'm happy to take it but for the sake of accountability please add the
appropriate Fixes: tag and offer some more context on what tools you're
using to find issues like this.

Kind regards,

> 
> Signed-off-by: Francois Berder <fberder at outlook.fr>
> ---
>  drivers/clk/qcom/clock-qcom.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/qcom/clock-qcom.c b/drivers/clk/qcom/clock-qcom.c
> index 6b46d9db744..e238b76d42e 100644
> --- a/drivers/clk/qcom/clock-qcom.c
> +++ b/drivers/clk/qcom/clock-qcom.c
> @@ -489,8 +489,14 @@ static const struct reset_ops qcom_reset_ops = {
>  
>  static int qcom_reset_probe(struct udevice *dev)
>  {
> +	void *base;
> +
> +	base = dev_read_addr_ptr(dev);
> +	if (!base)
> +		return -EINVAL;
> +
>  	/* Set our priv pointer to the base address */
> -	dev_set_priv(dev, (void *)dev_read_addr(dev));
> +	dev_set_priv(dev, base);
>  
>  	return 0;
>  }
> @@ -564,8 +570,14 @@ static const struct power_domain_ops qcom_power_ops = {
>  
>  static int qcom_power_probe(struct udevice *dev)
>  {
> +	void *base;
> +
> +	base = dev_read_addr_ptr(dev);
> +	if (!base)
> +		return -EINVAL;
> +
>  	/* Set our priv pointer to the base address */
> -	dev_set_priv(dev, (void *)dev_read_addr(dev));
> +	dev_set_priv(dev, base);
>  
>  	return 0;
>  }

-- 
// Casey (she/her)



More information about the U-Boot mailing list