cpufreq: brcmstb-avs-cpufreq: ISO C90 forbids mixed declarations
authorPortia Stephens <portia.stephens@canonical.com>
Wed, 24 Apr 2024 05:02:20 +0000 (15:02 +1000)
committerViresh Kumar <viresh.kumar@linaro.org>
Thu, 25 Apr 2024 05:06:40 +0000 (10:36 +0530)
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>
drivers/cpufreq/brcmstb-avs-cpufreq.c

index 1a1857b0a6f482d4e07a9c4a58ff66bb5d98cebd..ea8438550b490160d219c791d35343776eabea0b 100644 (file)
@@ -481,9 +481,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;
 
        cpufreq_cpu_put(policy);