Re: [PATCH v6 07/12] watchdog: wdt-uclass.c: add wdt_stop_all() helper

Wolfgang Denk
2021-08-19T11:37:48Z

Dear Rasmus,

again: error handling.

In message <20210819095706.3585923-8-rasmus.villemoes@prevas.dk> you wrote:
>
> --- a/drivers/watchdog/wdt-uclass.c
> +++ b/drivers/watchdog/wdt-uclass.c
> @@ -116,6 +116,31 @@ int wdt_stop(struct udevice *dev)
> return ret;
> }
>
> +int wdt_stop_all(void)
> +{
> + struct wdt_priv *priv;
> + struct udevice *dev;
> + struct uclass *uc;
> + int ret, err;
> +
> + ret = uclass_get(UCLASS_WDT, &uc);
> + if (ret)
> + return ret;
> +
> + uclass_foreach_dev(dev, uc) {
> + if (!device_active(dev))
> + continue;
> + priv = dev_get_uclass_priv(dev);
> + if (!priv->running)
> + continue;

Potential NULL pointer dereferencing.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
I paid too much for it, but its worth it.