From 25b3acf7b19a7fdef0ed75dea032b1aa07aac8bf Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Thu, 11 Aug 2016 17:25:27 +0900 Subject: [PATCH] [COMMON] thermal: cpu_cooling: Except cpu frequency is 0 Before initialize CPUFreq, cpufreq_quick_get() could retrun 0. Change-Id: I7cc64d206c668721991fe9c8369ee36421d62a2f Signed-off-by: Hyeonseong Gil --- drivers/thermal/cpu_cooling.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 04eb62a83f62..45d64b820add 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -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); -- 2.20.1