[PATCH 2/5] spi: cadence_qspi: Use dev_read_addr_index_ptr()

Simon Glass sjg at chromium.org
Fri May 29 08:58:42 CEST 2026


Hi Peng,

On 2026-05-27T02:35:23, Peng Fan (OSS) <peng.fan at oss.nxp.com> wrote:
> spi: cadence_qspi: Use dev_read_addr_index_ptr()
>
> Use dev_read_addr_index_ptr() and dev_read_addr_size_index_ptr() which
> support both live device tree and flat DT backends, avoiding direct
> dependency on devfdt_* helpers.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>
> drivers/spi/cadence_qspi.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

> diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
> @@ -418,8 +418,11 @@ static int cadence_spi_of_to_plat(struct udevice *bus)
> -     plat->regbase = devfdt_get_addr_index_ptr(bus, 0);
> -     plat->ahbbase = devfdt_get_addr_size_index_ptr(bus, 1, &plat->ahbsize);
> +     plat->regbase = dev_read_addr_index_ptr(bus, 0);
> +     plat->ahbbase = dev_read_addr_size_index_ptr(bus, 1, &plat->ahbsize);
> +     if (!plat->regbase || !plat->ahbbase)
> +             return -EINVAL;
> +

Reviewed-by: Simon Glass <sjg at chromium.org>

Not quite "no functional changes" - this adds a NULL check that didn't
exist before; previously the driver would store NULL and crash later.
The new behaviour is better!

Regards,
Simon


More information about the U-Boot mailing list