From patchwork Tue May 2 10:08:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 98434 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1794329qgf; Tue, 2 May 2017 03:10:10 -0700 (PDT) X-Received: by 10.84.238.199 with SMTP id l7mr10503608pln.153.1493719809644; Tue, 02 May 2017 03:10:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p88si17221074pfi.230.2017.05.02.03.10.09; Tue, 02 May 2017 03:10:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751753AbdEBKKE (ORCPT + 10 others); Tue, 2 May 2017 06:10:04 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34500 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688AbdEBKKA (ORCPT ); Tue, 2 May 2017 06:10:00 -0400 Received: by mail-pf0-f178.google.com with SMTP id e64so49646847pfd.1 for ; Tue, 02 May 2017 03:10:00 -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=Aj1P91bNy7GpmeBFbhGT6Iu5DO6C2EaUvqQMOXu1peA=; b=ReWNvMrObbdqQSiAlrZa7m261Jy4z8t7T/5xCBuP022Oq9gkijGn6bx1OUNRpmoC0z 2s3oAL/Z8ZY5+fw+azeEask2TBBYY2YlGTkxx5EiSA61+UXBe771/Ur7Phxlgxx74/D4 qEbIoL5GD9i5ykEQxlcribgBwmBPt3rhC3+Ds= 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=Aj1P91bNy7GpmeBFbhGT6Iu5DO6C2EaUvqQMOXu1peA=; b=AXoAgmmjbk4R6hQrrhrQiBkVvB2CspltBOYj/e84h9sjs/7Br5/pmeBrpnjerqlw3B HW7TX/d9f3N8f7m4rv6+tvUsSi53Dt5bjXCP3vtnQeHgIHQ81Ll+zmdbDf4twB9WuKid 7zMCS6D6m6E2tzX79thP7N6/KMgflR45Mr63qvBmHXIfvR94xRxk0kR0aymlPZum3G/j mNkXJBaUCIMX286PrGZMiu56HYAniz1KVwvPv7+ibVd8BCk5MxsaB3dQB0svL54zTtlp +5lquifmXqXQ+J1Qjotdg3s31Z9NfBnuiYMPvlD5DCjN+kbj4cX5Xm0qhxQ9UvpAvwRy LxEw== X-Gm-Message-State: AN3rC/580NfttyqFuzUaR4mw5/Mw1TY46MAxOXBoVbDGJL153Cwx6BYb SONdQmphYrMQ8hsi X-Received: by 10.98.76.26 with SMTP id z26mr31497092pfa.14.1493719799492; Tue, 02 May 2017 03:09:59 -0700 (PDT) Received: from localhost.localdomain (45-125-195-13.ip4.readyserver.sg. [45.125.195.13]) by smtp.gmail.com with ESMTPSA id 70sm29713046pfk.49.2017.05.02.03.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 03:09:58 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Rob Herring , Mark Rutland , Wei Xu , Catalin Marinas , Will Deacon , Andy Gross , David Brown , Mathieu Poirier , Greg Kroah-Hartman , Suzuki K Poulose , Stephen Boyd , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Mike Leach , Sudeep Holla Cc: Leo Yan Subject: [PATCH v8 3/7] coresight: of_get_coresight_platform_data: Add missing of_node_put Date: Tue, 2 May 2017 18:08:33 +0800 Message-Id: <1493719717-27698-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493719717-27698-1-git-send-email-leo.yan@linaro.org> References: <1493719717-27698-1-git-send-email-leo.yan@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 859ad49..de7e8ce 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -108,7 +108,8 @@ struct coresight_platform_data *of_get_coresight_platform_data( 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; @@ -175,17 +176,19 @@ struct coresight_platform_data *of_get_coresight_platform_data( } 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);