From patchwork Thu Oct 12 10:32:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 115604 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp1774186qgn; Thu, 12 Oct 2017 03:32:36 -0700 (PDT) X-Google-Smtp-Source: AOwi7QASvVH7DuFZDKTfMIoEAwmgfzbH0fjd9s7Dnr16zOlGtPsOU08YEipJ3OU6dBQoRtkmsbgh X-Received: by 10.84.129.11 with SMTP id 11mr1809477plb.379.1507804356861; Thu, 12 Oct 2017 03:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507804356; cv=none; d=google.com; s=arc-20160816; b=fAPaCJSNysy6Ao5K9aF8cK7+Usn2sxMvVDbryaHUs1SspeFvZ2RvDwBQrK/52kuVA6 PQ6ywC/9S0JYQ5Bf+T6P55hYLhSow6QMK5fVfhkDIaRvm3OeL8ewxzMtWsdjCKeIu2qu q24P7Q3khZuD9GO1tM7ONpfapruCzSHO7s4ZPfdTmE48EF/U/W9f2oVlmjDnIyA50X+4 79d6nBT4eZD3lyGiQaQWcDfsgV5QU/RG/LzmI4fjr8GjQZJ9ozQP/NNnDQ1posjs7Y/E 1bGXY9Js6uYSvtuQZ91jhvfdNHr9tlQ9pu7VtkxaQHHQ/mHFKDzTuZ8KdNrwTSMn7vx8 zyzQ== 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=S6N4F7XM3GrOE5+QGuSzn+pKdbK4C9RsiTMpuaYaLJc=; b=P4RFoXyceo60MgqxdvWf+K+d0rYfuNKN5LP6KsDNIlEFPIQuTwYCimybdLyG9mTvzM 1so2N4PA8mQssl7ohqwK6Z/0wsYOp9ItEZGeLJAOBYDQiSXm5Mt/xytXxWO00tXKzr4H /v5otiPJnuyxTr5R47q28Yi0N0two/niUKWTyxx2l5fD+hgLWPIentb543ibqVLI3W5Y My+hTlOmmPfUqrAFDIJCKrfpZxVJiseBrXnqNl+0WDdwlXEBRiEtfYfPFkhK1WTiozhp wwNK754jJW1sDXYUm/v3s1xQgsIxHckBzgWAJgqEEmyu7pkFXM+xHtRs9hWiCwAmz6p2 +8sw== 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 y23si5784174pfa.140.2017.10.12.03.32.35; Thu, 12 Oct 2017 03:32:36 -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 S1752691AbdJLKce (ORCPT + 12 others); Thu, 12 Oct 2017 06:32:34 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43262 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbdJLKce (ORCPT ); Thu, 12 Oct 2017 06:32:34 -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 1801A1435; Thu, 12 Oct 2017 03:32:34 -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 D92AA3F599; Thu, 12 Oct 2017 03:32:32 -0700 (PDT) From: Sudeep Holla To: Stephen Boyd , Viresh Kumar , linux-pm@vger.kernel.org Cc: Sudeep Holla , Nishanth Menon , "Rafael J. Wysocki" Subject: [PATCH v3] PM / OPP: add missing of_node_put() for of_get_cpu_node() Date: Thu, 12 Oct 2017 11:32:23 +0100 Message-Id: <1507804343-2472-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: Nishanth Menon Cc: Stephen Boyd Cc: "Rafael J. Wysocki" Acked-by: Viresh Kumar Fixes: 762792913f8c ("PM / OPP: Fix get sharing CPUs when hotplug is used") Signed-off-by: Sudeep Holla --- drivers/opp/of.c | 5 +++-- 1 file changed, 3 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 v2->v3: - Moved of_node_put before if condition -- 2.7.4 Reviewed-by: Stephen Boyd diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 87509cb69f79..cb716aa2f44b 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -604,7 +604,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,6 +614,7 @@ 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); + of_node_put(cpu_np); if (!tmp_np) { pr_err("%pOF: Couldn't find opp node\n", cpu_np); ret = -ENOENT;