From patchwork Thu May 25 15:57:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 9748615 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 999996032C for ; Thu, 25 May 2017 16:01:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A334281E1 for ; Thu, 25 May 2017 16:01:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E8DB28414; Thu, 25 May 2017 16:01:26 +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 09A0028418 for ; Thu, 25 May 2017 16:01:26 +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=dQusvaZMF8SLWya+n3GjlGEmMc feW97qKnEzbtVGtf9QXLRwjOnxfgR8gXxSoYkWF4Cdps33sT5RA6od4GXG5HICi3Ajzl1E91XHEkC /che3GugIQbLU6n8oMsk6Blp+8/VqwZvRocxHX4x8mD+YBxREO7DgXvpKWigZtZOLiwMhoIqrNA/P wmkmHBiflU6NW6G/PpQZ4W2MVXZICcTALF+y5IwoKyEs+bW9/CFTw6REN8jEeJRT5/OQXfIQqqrb3 L27CS9D9FNMaeyFjUyVCBT/5/LU/KnIOqS+w5k7dl3ZcOocupNfqgst9qfjrHbTUuterFabyHu2Hg WoIkxUdQ==; 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 1dDvCW-0004EC-QF; Thu, 25 May 2017 16:01:24 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDvBd-0003Jw-0j for linux-arm-kernel@bombadil.infradead.org; Thu, 25 May 2017 16:00:29 +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=EdnjhyC1a4zP7biTTwiURo40t 8PJrd6lEBqthDY+0qlGQaGa8K74AxvPmVcZ92YhHOPD88e9dO36ChMqNgm9QJYPAU8l9P8PMAKRvc 7RYZb2Zei6g/QaDYnU8fpB+NvDiBw/uZgVjwLyOvEPIGdMtmOAgjIqUiAU4BOpj/x/hfWKIdQ8MNI OgYPyWccic7kDdemn8JHAGdBi8fXPCUZSgeYNnKCiOc9pe71eeMJGfD+hh3PGGHsnWNyXnpcMcbhu XXUjfaAeYFmUy/VTqY1Vaj2ZEFlSKXy9L2VdiFz3naXVDhSDFMJ7qv0nBRsrkzFm11erpjBXRCCK2 QAqA0lGjQ==; Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDvBb-0003on-O8 for linux-arm-kernel@lists.infradead.org; Thu, 25 May 2017 16:00:28 +0000 Received: by mail-pf0-x22d.google.com with SMTP id 9so171071328pfj.1 for ; Thu, 25 May 2017 09:00:06 -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=CKIQaXOONjy/Hec2F7dxKndiBMhno6MDnGjh2xqKermhTm9QV+k8U4QkVdNFtmHj6j dFsObj4jlgX9L/yiFGE9k6O9J9h5Rn6+VYhWVZ0hMjkYPsLe8kcFRbDDEz/JpsLXZaBa 0d7aeG4qZJ3sU2SiElR6/OmlE7O+84Ib5nUZI= 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=XJxIKgDbpUYAPV3VEByZ2z6TDfJ4BShdHODm+7HR82fmwg6Ivv5nS42k29ji3HO8Uc ORtz4wrFTWOOP0u/NR46XoYUOgnLv8LD0cqZGP2jiiD4880DUfXBEQMgzzuvJWv2YwAj Ixg+iDt+EcH44HiKZAd4RxoMzbCCwCK1XbkY5f65UfcjQP2DONace68OmSSES5KWFiBI awrPYdeFIjDbGRwXNAIIdQx9Bi/X9wGY/mkmDwamSDSFV9SZaaw24VakvsMs7ffcVflV rSelT+DZbby4U+I08k5908QkyyAr2HACB/vvx+mSQj6hoEi7Oyi8/ffcJmr+7rn9/v3X jE0A== X-Gm-Message-State: AODbwcDPIqprVtCKVXpSAweqOaH610rtxZmfJjKJ3ZOObPLnY7l9IVYG 1OVZJsZF2jxbYHmV X-Received: by 10.84.217.142 with SMTP id p14mr34704846pli.192.1495728005665; Thu, 25 May 2017 09:00:05 -0700 (PDT) Received: from localhost.localdomain (li1068-205.members.linode.com. [106.184.3.205]) by smtp.gmail.com with ESMTPSA id o76sm16355942pfi.119.2017.05.25.08.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 May 2017 09:00:04 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Mathieu Poirier , Rob Herring , Mark Rutland , 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 v13 5/9] coresight: of_get_coresight_platform_data: Add missing of_node_put Date: Thu, 25 May 2017 23:57:12 +0800 Message-Id: <1495727836-30094-6-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495727836-30094-1-git-send-email-leo.yan@linaro.org> References: <1495727836-30094-1-git-send-email-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170525_120027_857186_921350C8 X-CRM114-Status: GOOD ( 13.91 ) 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);