diff mbox

thermal: of: fix cleanup when building a thermal zone

Message ID 1458935741-21355-1-git-send-email-brindisu@lab126.com (mailing list archive)
State Accepted
Headers show

Commit Message

Ulises Brindis March 25, 2016, 7:55 p.m. UTC
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>
---
 drivers/thermal/of-thermal.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eduardo Valentin March 28, 2016, 1:43 p.m. UTC | #1
On Fri, Mar 25, 2016 at 12:55:41PM -0700, Ulises Brindis wrote:
> 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.

Thanks for your patch. Queueing into my -fixes branch.

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 9043f8f..0f1c420 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -825,7 +825,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: