[PATCH v2] drivers: watchdog: Fix dev_read_addr error check
Hal Feng
hal.feng at starfivetech.com
Fri May 29 04:42:31 CEST 2026
> On 26.05.26 04:33, Francois Berder wrote:
> dev_read_addr does not return a void* but fdt_addr_t.
> Replace invalid usage of dev_read_addr by dev_read_addr_ptr.
I think the better reason for the change is what you said in the other patch:
"dev_read_addr returns FDT_ADDR_T_NONE (-1), not NULL, in case of errors."
Anyway,
Reviewed-by: Hal Feng <hal.feng at starfivetech.com>
Best regards,
Hal
>
> v2:
> - Replace dev_read_addr by dev_read_addr_ptr
> - Change error to EINVAL
>
> Signed-off-by: Francois Berder <fberder at outlook.fr>
> ---
> drivers/watchdog/starfive_wdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/starfive_wdt.c b/drivers/watchdog/starfive_wdt.c
> index ee9ec4cdc3a..d2c16150f4c 100644
> --- a/drivers/watchdog/starfive_wdt.c
> +++ b/drivers/watchdog/starfive_wdt.c
> @@ -290,9 +290,9 @@ static int starfive_wdt_of_to_plat(struct udevice *dev) {
> struct starfive_wdt_priv *wdt = dev_get_priv(dev);
>
> - wdt->base = (void *)dev_read_addr(dev);
> + wdt->base = dev_read_addr_ptr(dev);
> if (!wdt->base)
> - return -ENODEV;
> + return -EINVAL;
>
> wdt->apb_clk = devm_clk_get(dev, "apb");
> if (IS_ERR(wdt->apb_clk))
> --
> 2.43.0
More information about the U-Boot
mailing list