[COMMON] thermal: cpu_cooling: Except cpu frequency is 0
authorHyeonseong Gil <hs.gil@samsung.com>
Thu, 11 Aug 2016 08:25:27 +0000 (17:25 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:25 +0000 (17:13 +0900)
Before initialize CPUFreq, cpufreq_quick_get() could retrun 0.

Change-Id: I7cc64d206c668721991fe9c8369ee36421d62a2f
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/cpu_cooling.c

index 04eb62a83f6214ad19e9a54494b139545bae4f66..45d64b820addb5ca38271abac07aeac9df4b46ae 100644 (file)
@@ -600,6 +600,11 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev,
 
        freq = cpufreq_quick_get(policy->cpu);
 
+       if (freq == 0) {
+               *power = 0;
+               return 0;
+       }
+
        if (trace_thermal_power_cpu_get_power_enabled()) {
                u32 ncpus = cpumask_weight(policy->related_cpus);