Skip to content

Commit

Permalink
thermal: cpu_cooling: fix 'descend' check in get_property()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn Guo authored and Zhang Rui committed May 28, 2013
1 parent c240a53 commit 24c7a38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 24c7a38

Please sign in to comment.