ACPI: processor: thermal: avoid cpufreq_get_policy()
authorManfred Spraul <manfred@colorfullife.com>
Wed, 22 Dec 2021 14:09:31 +0000 (15:09 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 30 Dec 2021 18:39:34 +0000 (19:39 +0100)
cpu_has_cpufreq() stores a 'struct cpufreq_policy' on the stack.
Unfortunately, with debugging options enabled, the structure can be
larger than 1024 bytes, which causes a compiler warning/error.

(actually observed: 1184 bytes).

Therefore: Switch to cpufreq_cpu_get().

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/processor_thermal.c

index a3d34e3..d8b2dfc 100644 (file)
@@ -53,10 +53,17 @@ static int phys_package_first_cpu(int cpu)
 
 static int cpu_has_cpufreq(unsigned int cpu)
 {
-       struct cpufreq_policy policy;
-       if (!acpi_processor_cpufreq_init || cpufreq_get_policy(&policy, cpu))
+       struct cpufreq_policy *policy;
+
+       if (!acpi_processor_cpufreq_init)
                return 0;
-       return 1;
+
+       policy = cpufreq_cpu_get(cpu);
+       if (policy) {
+               cpufreq_cpu_put(policy);
+               return 1;
+       }
+       return 0;
 }
 
 static int cpufreq_get_max_state(unsigned int cpu)