summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>2024-12-24 12:18:09 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-17 13:40:48 +0100
commit5b80f2fe8a342e1457d3c53b850cf34c2f74d60d (patch)
treee486536c81fd83ed82e40bfa20b78da28475066f /drivers/thermal
parentdc63fd2e473d3883be85d82c749b19c664e32598 (diff)
downloadlinux-5b80f2fe8a342e1457d3c53b850cf34c2f74d60d.tar.gz
linux-5b80f2fe8a342e1457d3c53b850cf34c2f74d60d.tar.bz2
linux-5b80f2fe8a342e1457d3c53b850cf34c2f74d60d.zip
thermal: of: fix OF node leak in of_thermal_zone_find()
[ Upstream commit 9164e0912af206a72ddac4915f7784e470a04ace ] of_thermal_zone_find() calls of_parse_phandle_with_args(), but does not release the OF node reference obtained by it. Add a of_node_put() call when the call is successful. Fixes: 3fd6d6e2b4e8 ("thermal/of: Rework the thermal device tree initialization") Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> Link: https://patch.msgid.link/20241224031809.950461-1-joe@pf.is.s.u-tokyo.ac.jp [ rjw: Changelog edit ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_of.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 07e09897165f..5d3d8ce672cd 100644
--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -176,6 +176,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int
goto out;
}
+ of_node_put(sensor_specs.np);
if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ?
sensor_specs.args[0] : 0)) {
pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child);