diff mbox series

[v2,2/2] cpufreq: brcmstb-avs-cpufreq: ISO C90 forbids mixed declarations

Message ID 20240910112550.1144379-3-koichiro.den@canonical.com
State New
Headers show
Series CVE-2024-27051 | expand

Commit Message

Koichiro Den Sept. 10, 2024, 11:25 a.m. UTC
From: Portia Stephens <portia.stephens@canonical.com>

There is a compile warning because a NULL pointer check was added before
a struct was declared. This moves the NULL pointer check to after the
struct is declared and moves the struct assignment to after the NULL
pointer check.

Fixes: f661017e6d32 ("cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return value")
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
(backported from fa7bd98f3c8b33fb68c6b2bc69cff32b63db69f8)
[koichiroden: Adjusted context due to missing commit a48ac1c9f294
 ("cpufreq: brcmstb-avs: fix imbalance of cpufreq policy refcount")]
CVE-2024-27051
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
---
 drivers/cpufreq/brcmstb-avs-cpufreq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c
index 1302e1900dcb..75f02058efaf 100644
--- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
+++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
@@ -457,9 +457,12 @@  static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
 static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
 {
 	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+	struct private_data *priv;
+
 	if (!policy)
 		return 0;
-	struct private_data *priv = policy->driver_data;
+
+	priv = policy->driver_data;
 
 	return brcm_avs_get_frequency(priv->base);
 }