Re: [PATCH] thermal/drivers/rcar: add error checking in probe()
From: Geert Uytterhoeven
Date: Tue Jun 23 2026 - 04:04:58 EST
Hi Dan,
Thanks for your patch!
On Tue, 23 Jun 2026 at 09:49, Dan Carpenter <error27@xxxxxxxxx> 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 <error27@xxxxxxxxx>
> --- 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 -- geert@xxxxxxxxxxxxxx
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