From patchwork Fri Mar 25 19:55:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulises Brindis X-Patchwork-Id: 8673001 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8D4C1C0553 for ; Fri, 25 Mar 2016 19:55:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9DC0202A1 for ; Fri, 25 Mar 2016 19:55:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E539C2035B for ; Fri, 25 Mar 2016 19:55:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752705AbcCYTzY (ORCPT ); Fri, 25 Mar 2016 15:55:24 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:56393 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbcCYTzX (ORCPT ); Fri, 25 Mar 2016 15:55:23 -0400 X-IronPort-AV: E=Sophos;i="5.24,392,1454976000"; d="scan'208";a="76614953" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-6013.iad6.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Mar 2016 19:55:21 +0000 Received: from u90b11c75695d56b925a3.ant.amazon.com (iad1-ws-svc-lb91-vlan2.amazon.com [10.0.103.146]) by email-inbound-relay-6013.iad6.amazon.com (8.14.7/8.14.7) with ESMTP id u2PJtHIY014090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Mar 2016 19:55:18 GMT Received: from u90b11c75695d56b925a3.ant.amazon.com (localhost [127.0.0.1]) by u90b11c75695d56b925a3.ant.amazon.com (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id u2PJtmhK021408; Fri, 25 Mar 2016 12:55:48 -0700 Received: (from brindisu@localhost) by u90b11c75695d56b925a3.ant.amazon.com (8.14.4/8.14.4/Submit) id u2PJtmLb021405; Fri, 25 Mar 2016 12:55:48 -0700 From: Ulises Brindis Cc: Ulises Brindis , Zhang Rui , Eduardo Valentin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: of: fix cleanup when building a thermal zone Date: Fri, 25 Mar 2016 12:55:41 -0700 Message-Id: <1458935741-21355-1-git-send-email-brindisu@lab126.com> X-Mailer: git-send-email 1.7.9.5 To: unlisted-recipients:; (no To-header on input) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, TVD_FROM_1, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/thermal/of-thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: