diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index d8ec44b194d64a012c1dff1472c233f83f1119b0..82dd82afa55599a9e5befb3080f70693d91f36a5 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -906,7 +906,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) return tz; free_tbps: - for (i = 0; i < tz->num_tbps; i++) + for (i = i - 1; i >= 0; i--) of_node_put(tz->tbps[i].cooling_device); kfree(tz->tbps); free_trips: