]> git.karo-electronics.de Git - karo-tx-linux.git/commit
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)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:53:53 +0000 (09:53 +0800)
commitc00cfe8d3dbed901d52e45b57359ebe1d8388569
treefdfb4e3dcea2220b37152858f7fba8cc2af1a304
parent1b7f7ac3ead56b3215b9d933d33ab7efcb2c38a9
thermal: cpu_cooling: fix 'descend' check in get_property()

Commit 24c7a381720843f17efb42de81f7e85aefd6f616 upstream.

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>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
drivers/thermal/cpu_cooling.c