Re: [PATCH] thermal/drivers/rcar: add error checking in probe()
Geert Uytterhoeven <[email protected]> Tue, 23 Jun 2026 10:03:33 +0200
| Newsgroups | org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.linux-renesas-soc |
|---|---|
| Message-ID | <CAMuHMdUXkXCj7ijeQmOkK7OQSAGkYgBZJyMJoEV4i_XhamwDSQ@mail.gmail.com> |
Hi Dan, Thanks for your patch! On Tue, 23 Jun 2026 at 09:49, Dan Carpenter <[email protected]> wrote: > The thermal_zone_device_register_with_trips() can fail for a number of > reasons, including allocation failures. Check for error pointers to > avoid an error pointer dereference. > > Fixes: 9d617949d490 ("thermal/drivers/renesas: Group all renesas thermal drivers together") This is not the commit you are looking for... Fixes: bbcf90c0646ac797 ("thermal: Explicitly enable non-changing thermal zone devices") > Signed-off-by: Dan Carpenter <[email protected]> > --- a/drivers/thermal/renesas/rcar_thermal.c > +++ b/drivers/thermal/renesas/rcar_thermal.c > @@ -492,6 +492,11 @@ static int rcar_thermal_probe(struct platform_device *pdev) > "rcar_thermal", trips, ARRAY_SIZE(trips), priv, > &rcar_thermal_zone_ops, NULL, 0, > idle); > + if (IS_ERR(priv->zone)) { > + ret = PTR_ERR(priv->zone); > + priv->zone = NULL; > + goto error_unregister; > + } This check is already present below (out of context), so it would be good to avoid duplicating it. > > ret = thermal_zone_device_enable(priv->zone); > if (ret) { The issue is that this call was added before the error checking is done. So this should be moved below instead (to the else branch of the next chip->use_of_thermal test?). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds