]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.10/cpufreq-brcmstb-avs-cpufreq-fix-up-add-check-for-cpufreq_cpu_get-s-return-value.patch
5.10-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.10 / cpufreq-brcmstb-avs-cpufreq-fix-up-add-check-for-cpufreq_cpu_get-s-return-value.patch
1 From 6ae10467fb966d6efb10a13cafd47f8d2a264880 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Wed, 27 Mar 2024 15:21:45 +0100
4 Subject: cpufreq: brcmstb-avs-cpufreq: fix up "add check for cpufreq_cpu_get's return value"
5
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7
8 In commit 9127599c075c ("cpufreq: brcmstb-avs-cpufreq: add check for
9 cpufreq_cpu_get's return value"), build warnings occur because a
10 variable is created after some logic, resulting in:
11
12 drivers/cpufreq/brcmstb-avs-cpufreq.c: In function 'brcm_avs_cpufreq_get':
13 drivers/cpufreq/brcmstb-avs-cpufreq.c:486:9: error: ISO C90 forbids mixed
14 declarations and code [-Werror=declaration-after-statement]
15 486 | struct private_data *priv = policy->driver_data;
16 | ^~~~~~
17 cc1: all warnings being treated as errors
18 make[2]: *** [scripts/Makefile.build:289:
19 drivers/cpufreq/brcmstb-avs-cpufreq.o] Error 1
20 make[1]: *** [scripts/Makefile.build:552: drivers/cpufreq] Error 2
21 make[1]: *** Waiting for unfinished jobs....
22 make: *** [Makefile:1907: drivers] Error 2
23
24 Fix this up.
25
26 Link: https://lore.kernel.org/r/e114d9e5-26af-42be-9baa-72c3a6ec8fe5@oracle.com
27 Link: https://lore.kernel.org/stable/20240327015023.GC7502@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net/T/#m15bff0fe96986ef780e848b4fff362bf8ea03f08
28 Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
29 Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
30 Fixes: 9127599c075c ("cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return value")
31 Cc: Anastasia Belova <abelova@astralinux.ru>
32 Cc: Viresh Kumar <viresh.kumar@linaro.org>
33 Cc: Sasha Levin <sashal@kernel.org>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 ---
36 drivers/cpufreq/brcmstb-avs-cpufreq.c | 5 +++--
37 1 file changed, 3 insertions(+), 2 deletions(-)
38
39 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c
40 +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c
41 @@ -481,10 +481,11 @@ static bool brcm_avs_is_firmware_loaded(
42 static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
43 {
44 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
45 + struct private_data *priv;
46 +
47 if (!policy)
48 return 0;
49 - struct private_data *priv = policy->driver_data;
50 -
51 + priv = policy->driver_data;
52 cpufreq_cpu_put(policy);
53
54 return brcm_avs_get_frequency(priv->base);