From: Shawn Guo Date: Tue, 28 May 2013 06:22:32 +0000 (+0000) Subject: thermal: cpu_cooling: fix 'descend' check in get_property() X-Git-Tag: v3.11-rc1~27^2~5^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24c7a381720843f17efb42de81f7e85aefd6f616;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 Signed-off-by: Zhang Rui --- diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index c94bf2e..82e15db 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;