[<prev] [next>] [day] [month] [year] [list]
Message-ID: <84e202eb-40f3-4132-b2d3-67069a2bba70@web.de>
Date: Thu, 3 Oct 2024 10:30:12 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: linux-pm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Andrew Lunn <andrew@...n.ch>, Gregory Clement <gregory.clement@...tlin.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org
Subject: [PATCH] cpufreq: mvebu: Call of_node_put(np) only once in
armada_xp_pmsu_cpufreq_init()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 3 Oct 2024 10:18:39 +0200
An of_node_put(np) call was immediately used after a return value check
for an of_address_to_resource() call in this function implementation.
Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/cpufreq/mvebu-cpufreq.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/cpufreq/mvebu-cpufreq.c b/drivers/cpufreq/mvebu-cpufreq.c
index 7f3cfe668f30..55ba7ad72c36 100644
--- a/drivers/cpufreq/mvebu-cpufreq.c
+++ b/drivers/cpufreq/mvebu-cpufreq.c
@@ -42,14 +42,12 @@ static int __init armada_xp_pmsu_cpufreq_init(void)
return 0;
ret = of_address_to_resource(np, 1, &res);
+ of_node_put(np);
if (ret) {
pr_warn(FW_WARN "not enabling cpufreq, deprecated armada-xp-cpu-clock binding\n");
- of_node_put(np);
return 0;
}
- of_node_put(np);
-
/*
* For each CPU, this loop registers the operating points
* supported (which are the nominal CPU frequency and half of
--
2.46.1
Powered by blists - more mailing lists