From patchwork Thu Apr 6 13:30:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 96973 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp733068obc; Thu, 6 Apr 2017 06:32:34 -0700 (PDT) X-Received: by 10.99.117.85 with SMTP id f21mr35472670pgn.143.1491485554699; Thu, 06 Apr 2017 06:32:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e70si1882255pfh.212.2017.04.06.06.32.34; Thu, 06 Apr 2017 06:32:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S934800AbdDFNcc (ORCPT + 7 others); Thu, 6 Apr 2017 09:32:32 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:34713 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934788AbdDFNcW (ORCPT ); Thu, 6 Apr 2017 09:32:22 -0400 Received: by mail-pg0-f44.google.com with SMTP id 21so36659490pgg.1 for ; Thu, 06 Apr 2017 06:32:22 -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=3Av8iWToggPzcj0Ikq904mM+c9jlhlxGamEgFpH5NSk=; b=fG/eFJGP58YKmXgq/4F1dtufSBcohg/3+JlfaUTXDFVBmq/7XLHGNCgYxtTyOCqZm3 PbeS8A4LR/HfS2AG0vueKZ0bqKkJuq96j5JPWwlxDcojshUg5056xorWKwP3N6fJtqTT m/93xspA5QtHG8MG0Cwe8QGZbgCXDBNK/2ghY= 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=3Av8iWToggPzcj0Ikq904mM+c9jlhlxGamEgFpH5NSk=; b=fzUma/mEJzPyMu0sv7cJu7/ihG3UngZWpas1pD8DvA+yt6LIPJ+nMURMTRL116yCuJ 4ly0kYwTB6jOes3vOMMHCP7Igq0UMG6o3RMebou0KgkdJuq8bubhXdjuf9DITJVJ130e y9Kte/AAK4hzBLcaIUNPYUCayTv3ywAhyRjsexHvfMf8kV1WdHCyt/mpzJu2eH8ptO/u KfSjkcYbw8rkmVdHnkyoQDlKOqv2TzlJAR4saJhlzVUlasxTYKQj4uIdrQ81azcl0uyt N/rE6y3L1O7kVzHuOH4xxrvALOrxrsCxuq6Z2n3SskzbDjPX9rHgdtI7QOx8lnmOX94e OdDA== X-Gm-Message-State: AFeK/H3ZiDDGJVHwOve4XfQFKbqAf3DshJzfs3ukOrVrBnqjR8pOSe6mJ/qTGi4E6GBo2cef X-Received: by 10.98.152.219 with SMTP id d88mr35213146pfk.153.1491485541778; Thu, 06 Apr 2017 06:32:21 -0700 (PDT) Received: from localhost.localdomain (li1627-128.members.linode.com. [172.104.47.128]) by smtp.gmail.com with ESMTPSA id 129sm4074223pgj.59.2017.04.06.06.32.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Apr 2017 06:32:20 -0700 (PDT) From: Leo Yan To: Jonathan Corbet , Rob Herring , Mark Rutland , Wei Xu , Catalin Marinas , Will Deacon , Andy Gross , David Brown , Mathieu Poirier , 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 v6 3/8] coresight: of_get_coresight_platform_data: Add missing of_node_put Date: Thu, 6 Apr 2017 21:30:56 +0800 Message-Id: <1491485461-22800-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491485461-22800-1-git-send-email-leo.yan@linaro.org> References: <1491485461-22800-1-git-send-email-leo.yan@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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 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 devicetree" 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 629e031..1a77280 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);