thermal: cpu_cooling: fix 'descend' check in get_property()
authorShawn Guo <shawn.guo@linaro.org>
Tue, 28 May 2013 06:22:32 +0000 (06:22 +0000)
committerAlex Shi <alex.shi@linaro.org>
Thu, 25 Sep 2014 05:19:00 +0000 (13:19 +0800)
commit3585453daba3b8be18deb1e472e779961be17f77
tree97a9bda2e65e1212b94f2ea86caea19c294d9902
parent0e0eabed5b2cc7b0fe07f219a866c708b569f560
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: Alex Shi <alex.shi@linaro.org>
drivers/thermal/cpu_cooling.c