Re: [PATCH] thermal: thermal_of: fix OF node leak in thermal_of_for_each_cooling_device()

From: Lukasz Luba

Date: Fri Nov 27 2026 - 02:57:04 EST




On 11/27/26 07:42, zhaofeng2@xxxxxxxxxxxxxxxxxxxx wrote:
From: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>

thermal_of_for_each_cooling_device() calls of_parse_phandle()
to obtain tr_np, uses it only to call of_find_trip_id(), and
then leaks it on every subsequent return path.

Drop the reference with of_node_put() once the node is no
longer needed.

Signed-off-by: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
---
Verified against current tree. Leak found by code inspection
(OF reference-counting audit of thermal_of_for_each_cooling_device()).

This function doesn't exist anymore. I has been removed with
94c6110b0b13c64161


thermal/thermal_of.c | 1 +-++
1 file changed, 1 insertion(+), 0 deletion(-)

--- a/drivers/thermal/thermal_of.c
+++ b/drivers/thermal/thermal_of.c
@@ -365,6 +365,7 @@
return -ENODEV;
trip_id = of_find_trip_id(tz_np, tr_np);
+ of_node_put(tr_np);
if (trip_id < 0)
return trip_id;





It's not a valid patch.