From: Ulises Brindis Date: Fri, 25 Mar 2016 19:55:41 +0000 (-0700) Subject: thermal: of: fix cleanup when building a thermal zone X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=1cd91c1820801267b5579fa65842cdf843c73c4d;p=deliverable%2Flinux.git thermal: of: fix cleanup when building a thermal zone 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 Cc: Eduardo Valentin Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ulises Brindis Signed-off-by: Eduardo Valentin --- diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index d8ec44b194d6..82dd82afa555 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -906,7 +906,7 @@ finish: 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: