All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/rcar: add error checking in probe()
@ 2026-06-23  7:49 Dan Carpenter
  2026-06-23  8:03 ` Geert Uytterhoeven
  2026-06-23  8:18 ` Niklas Söderlund
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2026-06-23  7:49 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Niklas Söderlund, Rafael J. Wysocki, Daniel Lezcano,
	Zhang Rui, Lukasz Luba, Geert Uytterhoeven, Magnus Damm,
	linux-renesas-soc, linux-pm, linux-kernel, kernel-janitors

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")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/thermal/renesas/rcar_thermal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/thermal/renesas/rcar_thermal.c b/drivers/thermal/renesas/rcar_thermal.c
index 6e5dcac5d47a..71f836fbc698 100644
--- 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;
+			}
 
 			ret = thermal_zone_device_enable(priv->zone);
 			if (ret) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-23  8:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  7:49 [PATCH] thermal/drivers/rcar: add error checking in probe() Dan Carpenter
2026-06-23  8:03 ` Geert Uytterhoeven
2026-06-23  8:13   ` Dan Carpenter
2026-06-23  8:18 ` Niklas Söderlund
2026-06-23  8:25   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.