From patchwork Wed May 24 00:02:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 100402 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp35079qge; Tue, 23 May 2017 17:05:25 -0700 (PDT) X-Received: by 10.98.155.28 with SMTP id r28mr34930428pfd.198.1495584325482; Tue, 23 May 2017 17:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495584325; cv=none; d=google.com; s=arc-20160816; b=KQ1dOvPg7teIllg26pqK4g9TmXeBzSRsCj3kVuzQ2AAo6czAUjaxZCVokOvKKnOHjv phS9smbbBEYmnE16Y1ZHfOSdX9wLcfcshp18UX3AhZ0oz9SiGmXumT8JYN8Ws1Qvs+9p tI9Nud9l+QL2mgcFIgz7hpkZfpD7z26m2KPcVzLQs2EXB/n+dm9+cw2Jeq5hOue1rYSS 7bvET2Aa8V7WMaMELHsPz6ZLEliA3o09sHW7RU1AX5SsywQV0AZVI3cnayaTVeHbwzL2 HxeCNLX1dqIaz85YnX8ZuGkGNwpfkjd7onaR52IMQlTcgw/WmcM6Z9L1JFM4wHjmTK/a SJXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=hcDcXtgP60PHO0UlA3jODhb8nyMHa+VSyO8LNe+l4yo=; b=oiDetCKSdP162p/EYTpuoi8YrjJ5vI7S6MtjCOIgf+Uc28pnNOsqU+O3Kl/F5WF85w CQPPBHTAqDkeybVWd02tbCyAL/GYo4INk/9By+ISPAe6iZNKyAJ/iD/nQWW3FNesFR8g mM+qGSPszsqEbO9EfmWlj3WUH6K1G7CtzWlxeZh0OK4EIYmH186YnXOtArlhJ2JLmlXO 2m1MG4ucGXCwQ8USwnuqD838T86ZNoU2uMdI2pGvIJ57qVKDoNXGrK0Dq0MwDUpRMtgL irB8dAFfEVXa12Lcm3NiH8sPvevonAlXnKbugy8lM3PJykB4WxfoPqutCUD8OKSd9F45 0OTA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si22195981pgn.167.2017.05.23.17.05.25; Tue, 23 May 2017 17:05:25 -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 S1763167AbdEXAFX (ORCPT + 10 others); Tue, 23 May 2017 20:05:23 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36659 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034411AbdEXADu (ORCPT ); Tue, 23 May 2017 20:03:50 -0400 Received: by mail-pf0-f178.google.com with SMTP id m17so129193924pfg.3 for ; Tue, 23 May 2017 17:03:50 -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=YOy8fmCISl692UVR9S8Yfpsk63bnWCd0/CwUkeU0UcTagJYjao1vASCcvCj7aPxpfA K6orXI4OLBRaCojKAfamMSrN+MKPT0v2YYW6jia1H4+bUn7pcnHqT0G24sL84a/OpuzI jAf0HKDoT/ssvWHqM3AKwutr8D95gwodmgbi4= 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=HpKcZfYfkwFQAnfc9bSn+ocsLXncCmxQQG56NSI/8/k7BCapORIvqeuTa5NOY2s/bH pR53J1fKxB+fEjQyvcfvDC/VegQKYO+VZQaK42HuCXuv24tLWNNjsR6gY80Kz5z1ef18 uRL80c0TaiqHmzub54Uo8HvA2ljwaUPGMUHB7ASh93FfmjTMOlV+YW+19lkcp9gwd70L cZ38T/sIBFTfqkhj8g0F/S14tMdmAP3z1KjaJhRrokXsZ3g8daJhEqjBZJQqUvwY4Mlv vShKguZ0MCxYvz+LUQLdKbTZic3tX0A861IkIzJJsv6qx6eQYqBsOCGOszNsmiemxAGe igtg== X-Gm-Message-State: AODbwcCo5C/VcoBda6TBIWFxjuXJNegBMeBvVS4N4fMiIVwNAdxsua91 L/NElE8tFm2q+6az X-Received: by 10.98.219.130 with SMTP id f124mr34542835pfg.171.1495584228404; Tue, 23 May 2017 17:03:48 -0700 (PDT) Received: from localhost.localdomain (li1068-205.members.linode.com. [106.184.3.205]) by smtp.gmail.com with ESMTPSA id l186sm3613987pgd.42.2017.05.23.17.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 May 2017 17:03:46 -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 Cc: Leo Yan Subject: [PATCH v12 5/9] coresight: of_get_coresight_platform_data: Add missing of_node_put Date: Wed, 24 May 2017 08:02:53 +0800 Message-Id: <1495584177-32193-6-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495584177-32193-1-git-send-email-leo.yan@linaro.org> References: <1495584177-32193-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 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);