From patchwork Tue May 23 14:16:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 9742951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 58A6F60380 for ; Tue, 23 May 2017 15:05:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49FE728111 for ; Tue, 23 May 2017 15:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ECB02855D; Tue, 23 May 2017 15:05:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E032A28111 for ; Tue, 23 May 2017 15:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9zAgCNzbXuuh84fkZgX+94jKceQWpmCqEe8vG8PqOWM=; b=bz2R1fRDqXJ8piYJXcjvEhOpLo u29RBNCaKSthCUkCunyzxGn+uIrllg6E3M178tuho5QPcpOL9v5UPJD0bGjh75mNakmXgNeqEvC4S 3TH55vdi+/2cVc5nFQZXu1kkoy43XrwvVTRLEry/FcgWNA5EPGe9v9pp1bQuFLtD9PreerXQ4s8mc tgigXrs/H0CWGLfYmQp9tXhDFHBnEWtz5EhWatboyfsnbfmR7Xx7c11CrnHgJQJwvHAQLm1rieTy6 TISPgabnUmX6AgifkSlbr+SPi4isyJaVRbCDe3SId7coYbGmLF0z2KLD2xbjFknvXCZUKp70Kge35 q3QgvdHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dDBNQ-00023T-ID; Tue, 23 May 2017 15:05:36 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDBNO-00023J-7d for linux-arm-kernel@bombadil.infradead.org; Tue, 23 May 2017 15:05:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KPg79NY3sGvLdvwjFFRlkg3unWx7G4i/7+aegEzxzF8=; b=uV9QkBFmez4s/VUhnfst/l4no I93wDJYy4VeAzSzu48F/OSsofOWnBfLNFqQH/Ye0O3iMZczY/yHHe42qIPru+kHT3QTUHONYwjV1t brOVdbsOJkbsj8nT2Z24OrreXzElx025JIU3HNNVWE6rkp23U09LC9yEOixof2E6Oc52EEWXhWcAJ DOVqTF36QPjwCLcGsUPfYtcQX6Pv25JVseTq4kDZ0PuqJ2kYzc/G3u2DIkKKLQoLPDBgwYyEMM6vp 7qaIl5E78HONq0n20U8stHh5dlP+Lxw4QTAR11VQX0s+dUkLnV6Nc+8u1TvE1kkNHkY2HrBFR5Kan TrSmzTBNA==; Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDAdI-0004FH-Tn for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2017 14:17:58 +0000 Received: by mail-pf0-x22a.google.com with SMTP id m17so116125462pfg.3 for ; Tue, 23 May 2017 07:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KPg79NY3sGvLdvwjFFRlkg3unWx7G4i/7+aegEzxzF8=; b=YwQvc6e7fdSqIntv72ZIGe7cFsPwXFMBk/X5rEWZ8+dqz/teiBg2L8ZDSjqTBODp5g vzFG3wTxN+5PbfeUZa42ZqPePlUCP50nN6Naz4gJhvXZ3Zgg5QYvskQlLDzcvTAawYs2 IlmMtPcp5HscU32R7h3/erK8CeSPU2SO7lhcU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KPg79NY3sGvLdvwjFFRlkg3unWx7G4i/7+aegEzxzF8=; b=uhy7VQC46zI9yP18R+eFlpNvZ7WBR4RbA3ovRq/d6385FbSGVSprZYuatJSc3HeQNE 9RclGWFirEh9xejcoZD09aAdrNpHnEujqVJsnkEHGIggleWM5dYhKfJNFiZHvgGclfat PKnAclkS4iEmFDhHPg1PDr25Dk/EbWfXozz3HEmEUfvZO/LKysV+FGqEYqv0XEM1G/NB /9/iAESMM8FX+6c6vlY39p/ms5wgYtWvbWyLV1XyMIt/XvRaE9LAc+NwNK6uWFCiLp/W AQl/zEZ4jjeqTBQf+blwRhTcjiVi5VMiNjtM+ESVu8ZHtPi3xA34M8sk0wO/tiYq9OPR Fq3g== X-Gm-Message-State: AODbwcDD63ogj61YnMrOe0+Z2MqQ8DoM8BuQkgt571H7upNjrDb008qU YkBU/8AwSdklarEX X-Received: by 10.99.169.26 with SMTP id u26mr2918728pge.177.1495549055280; Tue, 23 May 2017 07:17:35 -0700 (PDT) Received: from localhost.localdomain (li1068-205.members.linode.com. [106.184.3.205]) by smtp.gmail.com with ESMTPSA id x80sm1953334pff.105.2017.05.23.07.17.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 May 2017 07:17:34 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Mathieu Poirier , Rob Herring , Mark Rutland , Liviu Dudau , Wei Xu , Catalin Marinas , Will Deacon , Andy Gross , David Brown , Greg Kroah-Hartman , Suzuki K Poulose , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Stephen Boyd , Mike Leach Subject: [PATCH v11 5/9] coresight: of_get_coresight_platform_data: Add missing of_node_put Date: Tue, 23 May 2017 22:16:16 +0800 Message-Id: <1495548980-30432-6-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495548980-30432-1-git-send-email-leo.yan@linaro.org> References: <1495548980-30432-1-git-send-email-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170523_101757_043301_5D437A85 X-CRM114-Status: GOOD ( 14.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suzuki K Poulose The of_get_coresight_platform_data iterates over the possible CPU nodes to find a given cpu phandle. However it does not drop the reference to the node pointer returned by the of_get_coresight_platform_data. This patch also introduces another minor fix is to use of_cpu_device_node_get() to replace of_get_cpu_node(). Cc: Mathieu Poirier Reviewed-by: Suzuki K Poulose Signed-off-by: Suzuki K Poulose [Leo: minor tweaks for of_get_coresight_platform_data] Signed-off-by: Leo Yan --- drivers/hwtracing/coresight/of_coresight.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 2749853..225b2dd 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -109,7 +109,8 @@ of_get_coresight_platform_data(struct device *dev, struct coresight_platform_data *pdata; struct of_endpoint endpoint, rendpoint; struct device *rdev; - struct device_node *dn; + bool found; + struct device_node *dn, *np; struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; @@ -176,17 +177,19 @@ of_get_coresight_platform_data(struct device *dev, } while (ep); } - /* Affinity defaults to CPU0 */ - pdata->cpu = 0; dn = of_parse_phandle(node, "cpu", 0); - for (cpu = 0; dn && cpu < nr_cpu_ids; cpu++) { - if (dn == of_get_cpu_node(cpu, NULL)) { - pdata->cpu = cpu; + for_each_possible_cpu(cpu) { + np = of_cpu_device_node_get(cpu); + found = (dn == np); + of_node_put(np); + if (found) break; - } } of_node_put(dn); + /* Affinity to CPU0 if no cpu nodes are found */ + pdata->cpu = found ? cpu : 0; + return pdata; } EXPORT_SYMBOL_GPL(of_get_coresight_platform_data);