Commit 8a81cf96 authored by Julia Lawall's avatar Julia Lawall Committed by Rafael J. Wysocki

thermal/of: add missing of_node_put()

for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.

This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0bb80ecc
...@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip) ...@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip)
*/ */
for_each_child_of_node(trips, t) { for_each_child_of_node(trips, t) {
if (t == trip) if (t == trip) {
of_node_put(t);
goto out; goto out;
}
i++; i++;
} }
...@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, ...@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
for_each_child_of_node(cm_np, child) { for_each_child_of_node(cm_np, child) {
ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action); ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
if (ret) if (ret) {
of_node_put(child);
break; break;
}
} }
of_node_put(cm_np); of_node_put(cm_np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment