From patchwork Wed Oct 11 10:11:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 115534 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp570010qgn; Wed, 11 Oct 2017 03:11:15 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBQ3sSX7rwFh/EgQeTL6VTguGVEWRehtmN65o+/mk4E3gxp24JB2awzh6BFMrhuR7WM+ULq X-Received: by 10.159.234.68 with SMTP id c4mr3138674plr.52.1507716675041; Wed, 11 Oct 2017 03:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507716675; cv=none; d=google.com; s=arc-20160816; b=EsXMBXe+UZKOEgk76UXMK8Mlsgu/UoxA4/GZTLQMcNJhUpsq3mToyiv9RCUL4wgGlH kRhFTr89A/yxFkNMMlieclBbMdslPZaNExYZDEnlw5qooYQVpAJ8ErW0cTPIOAzZeZ2b 49mfHGmpD5YzTNPZsfNFfdXSLh/Flm5Gr5NAOXMwJ4uyKFIyoiyS0XfNhlhATLNej0hR f1NzcLb5JuVTi4SyGww8R6AYKol0/4sAtOJTxo5Afz8A+OwAwlte67l/WvnjrTE8p/eW 32MyVISmU+d8ruhVSq9+yqpbtv1MMqc0xTuC7brSFMHQKFDjAwX0f8E3coCnT/E5Z4OS CCCw== 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:arc-authentication-results; bh=8Lm8s5W8iuaHkKHLF8pSEG2CuzphK2T2CcLTaXVUnJE=; b=O3Rq898M3C1Y/QJr9mj28XZ8GveZfgahaIafBCxNeqUOFFE/ucdE5xaaPMfAIkos8W K/HaLbBI0nCKmoWeeM0u9RQdeh1JU5vtOQziaeGG9ZvgY/UJuYM2RwM8Gd2xQ55hVmiZ TQpxbAnBfJBo/A8hTh4O6y3PS4WpGDxLkdwDfhlDsadyx3w9XSTv9cFKlLjtTqShuBBh OYjZvGYqmmtbBMJYc1Rfu+pcxV2sLiKrVMhjdLfm4IgNAyYoZ5aAJAlV6IzWyC1izzBm gEUVCSpEd+G1Gs7nidWNbdDrG0i1hpOUlP+f205e4riAc3hJth7Y81/IwuEY714WJo4f mrXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si1448886plp.97.2017.10.11.03.11.14; Wed, 11 Oct 2017 03:11:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750912AbdJKKLO (ORCPT + 12 others); Wed, 11 Oct 2017 06:11:14 -0400 Received: from foss.arm.com ([217.140.101.70]:57742 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbdJKKLN (ORCPT ); Wed, 11 Oct 2017 06:11:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C498F; Wed, 11 Oct 2017 03:11:13 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (e107155-lin.cambridge.arm.com [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DA2553F3E1; Wed, 11 Oct 2017 03:11:11 -0700 (PDT) From: Sudeep Holla To: Viresh Kumar , linux-pm@vger.kernel.org Cc: Sudeep Holla , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Subject: [PATCH v2] PM / OPP: add missing of_node_put() for of_get_cpu_node() Date: Wed, 11 Oct 2017 11:11:01 +0100 Message-Id: <1507716661-27146-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507632519-19648-1-git-send-email-sudeep.holla@arm.com> References: <1507632519-19648-1-git-send-email-sudeep.holla@arm.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit 762792913f8c ("PM / OPP: Fix get sharing CPUs when hotplug is used") moved away from using cpu_dev->of_node because of some limitations. However commit 7467c9d95989 ("of: return of_get_cpu_node from of_cpu_device_node_get if CPUs are not registered") added support to falls back to of_get_cpu_node if called if CPUs are not registered yet. It adds the missing of_node_put for the CPU device nodes. This patch also moves back to use of_cpu_device_node_get in dev_pm_opp_of_get_sharing_cpus to avoid scanning the device tree again. Cc: Viresh Kumar Cc: Nishanth Menon Cc: Stephen Boyd Cc: "Rafael J. Wysocki" Fixes: 762792913f8c ("PM / OPP: Fix get sharing CPUs when hotplug is used") Signed-off-by: Sudeep Holla --- drivers/opp/of.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) v1->v2: - Moved of_node_put after using cpu_np - Renamed the $subject as fixing refcount is key part of the part and correctly relates to "Fixes" tag - Also added include change which was accidentally missed -- 2.7.4 Acked-by: Viresh Kumar diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 0b718886479b..6a486ad81259 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -603,7 +603,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, if (cpu == cpu_dev->id) continue; - cpu_np = of_get_cpu_node(cpu, NULL); + cpu_np = of_cpu_device_node_get(cpu); if (!cpu_np) { dev_err(cpu_dev, "%s: failed to get cpu%d node\n", __func__, cpu); @@ -614,10 +614,12 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, /* Get OPP descriptor node */ tmp_np = _opp_of_get_opp_desc_node(cpu_np); if (!tmp_np) { + of_node_put(cpu_np); pr_err("%pOF: Couldn't find opp node\n", cpu_np); ret = -ENOENT; goto put_cpu_node; } + of_node_put(cpu_np); /* CPUs are sharing opp node */ if (np == tmp_np)