diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-05-28 06:22:32 +0000 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2014-09-24 16:51:05 +0100 |
commit | bdbd85c64671b60697465306120d06f358192032 (patch) | |
tree | ade5e2cea24f84fac62eb20463692538d03262e6 | |
parent | 932dd335cbf1a55e268b7d6c055db8f70cdbf7ca (diff) |
thermal: cpu_cooling: fix 'descend' check in get_property()
The variable 'descend' is initialized as -1 in function get_property(),
and will never get any chance to be updated by the following code.
if (freq != CPUFREQ_ENTRY_INVALID && descend != -1)
descend = !!(freq > table[i].frequency);
This makes function get_property() return the wrong frequency for given
cooling level if the frequency table is sorted in ascending. Fix it
by correcting the 'descend' check in if-condition to 'descend == -1'.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit 24c7a381720843f17efb42de81f7e85aefd6f616)
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 78de7947afac..6093862ae7ad 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -167,7 +167,7 @@ static int get_property(unsigned int cpu, unsigned long input, continue; /* get the frequency order */ - if (freq != CPUFREQ_ENTRY_INVALID && descend != -1) + if (freq != CPUFREQ_ENTRY_INVALID && descend == -1) descend = !!(freq > table[i].frequency); freq = table[i].frequency; |