]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
thermal: of: fix cleanup when building a thermal zone
authorUlises Brindis <brindisu@lab126.com>
Fri, 25 Mar 2016 19:55:41 +0000 (12:55 -0700)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 17 May 2016 14:28:24 +0000 (07:28 -0700)
of_node_put is iterating through all terms in the tbps array even though
the bind has failed. We need to only iterate through the terms that have
already passed the binding step.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ulises Brindis <brindisu@lab126.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/of-thermal.c

index d8ec44b194d64a012c1dff1472c233f83f1119b0..82dd82afa55599a9e5befb3080f70693d91f36a5 100644 (file)
@@ -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: