From: Dan Carpenter <error27@gmail.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@kernel.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
linux-renesas-soc@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] thermal/drivers/rcar: add error checking in probe()
Date: Tue, 23 Jun 2026 10:49:29 +0300 [thread overview]
Message-ID: <ajo6iQ3VWvcxedA9@stanley.mountain> (raw)
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
next reply other threads:[~2026-06-23 7:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 7:49 Dan Carpenter [this message]
2026-06-23 8:03 ` [PATCH] thermal/drivers/rcar: add error checking in probe() Geert Uytterhoeven
2026-06-23 8:13 ` Dan Carpenter
2026-06-23 8:18 ` Niklas Söderlund
2026-06-23 8:25 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ajo6iQ3VWvcxedA9@stanley.mountain \
--to=error27@gmail.com \
--cc=daniel.lezcano@kernel.org \
--cc=geert+renesas@glider.be \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=magnus.damm@gmail.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=niklas.soderlund@ragnatech.se \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox