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: 100523 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp831065qge; Thu, 25 May 2017 09:00:27 -0700 (PDT) X-Received: by 10.98.103.207 with SMTP id t76mr44471140pfj.147.1495728027344; Thu, 25 May 2017 09:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495728027; cv=none; d=google.com; s=arc-20160816; b=CgM0b6nyWYv5g2NR7g+Li4ddpRyGSFWD1IwLsjLqhNsxtnOnCm+C3yXakkHo4/6Ba9 osXpYsq455Zre2uby3Uhgsajibig/IvkN/j+tZ4OHKXpk6cPAQ0PA9W9C2ZdgvcYPXkI ItMwesYelYrbm6SnYzMUnuHAJTOb30l68HT59g83hoeKxVyu4kVI9FyhTlcanKQCuqvS 5LreIvgMwzorr2f6ZIVY3wz8DiHvJjxkwuvFXvyoav1siDmjAKz0l76BFtJWjsV7hU63 vJPUVl6c4E82tWzYRYDD2yBJ3D5K54VhECkt/yAdLIjTMpwhpV8WVGMw3fbAp9PLdlaX /hiA== 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=yZZjnYbZ+kImRXond8BNkurrgO0M4dZ1JMtwkBXcckr0BCsry1uUbSElyd+pU2nrdr e9gcGh2OZi+jYHvesUGt9EqNLFWMnFrAjhHRpD9fSPMub6KzRA3hQHawgzAdOOpUvnma 9e4JnpVjm4ge5hCgV82yyWnRxk8FlffwIH8Jgvo76piAq86yItgYGBw5W7wlBeCLBniv 6n1sWMBScql9UkO68o+62grgV8a2z8g62vz0P5M8aLCpWgreKsP4yRIbhCC7W4V57RwD tqh1KfBjB/I5N1agweBW93ZDe74QVsxRjS1BbibmOQ7duKUu8mpYeCQFX0RtCBS17o/f utdw== 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 g189si26912518pgc.354.2017.05.25.09.00.26; Thu, 25 May 2017 09:00:27 -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 S1424515AbdEYQAL (ORCPT + 10 others); Thu, 25 May 2017 12:00:11 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34449 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424486AbdEYQAG (ORCPT ); Thu, 25 May 2017 12:00:06 -0400 Received: by mail-pf0-f172.google.com with SMTP id 9so171071334pfj.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=k2ROzVAWZMvlfFpNgwdHpvWtiduZr1VtcYAf6VRGXapw0pxsN5ej3I8su/ipHbnPjm tQ7CeSNuc2Z6oY1PclhpFvqedLTUWibGa9WaYut29qJubhfrukzmjptllgXoKc2prA03 /RuHZxohVF26s7CLB7GznY0wI2A386OJr4lq2Kq49jNimVtI7jUi+LB24/pmoCuTuiHt J5UPRDtrgKFYFsLeoeG0IpLa1sA0m+PLcDdgdpTvUAUm1gQAQJfRmB3IrOsxaKWMZO8N bpf36DyxoqqePxaBEGkSyTDLy/irzNtjYuUNh9b1NLhrcXZYgPVrKgxCvLri6jLmV/QY IgxQ== X-Gm-Message-State: AODbwcCsMjjZ/1VNGeVEyMYvRMnDyZhnEl4brgJSrnLwHPL4sZaEw1lx EEQnb9k1H3d+FQmg 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 Cc: Leo Yan 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> 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);