Skip to content

Commit a1fe789

Browse files
outman119rafaeljw
authored andcommitted
thermal/of: Fix reference leak in thermal_of_cm_lookup()
In thermal_of_cm_lookup(), tr_np is obtained via of_parse_phandle(), but never released. Use the __free(device_node) cleanup attribute to automatically release the node and fix the leak. Fixes: 423de5b ("thermal/of: Fix cdev lookup in thermal_of_should_bind()") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260124-thermal_of-v1-1-54d3416948cf@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1e46178 commit a1fe789

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/thermal/thermal_of.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ static bool thermal_of_cm_lookup(struct device_node *cm_np,
280280
struct cooling_spec *c)
281281
{
282282
for_each_child_of_node_scoped(cm_np, child) {
283-
struct device_node *tr_np;
284283
int count, i;
285284

286-
tr_np = of_parse_phandle(child, "trip", 0);
285+
struct device_node *tr_np __free(device_node) =
286+
of_parse_phandle(child, "trip", 0);
287287
if (tr_np != trip->priv)
288288
continue;
289289

0 commit comments

Comments
 (0)