Skip to content

Commit

Permalink
Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
Browse files Browse the repository at this point in the history
This code doesn't work on big endian systems because we're storing low
values in the high bits of the unsigned long.  It makes it a very high
value instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Dan Carpenter authored and Zhang Rui committed Apr 17, 2013
1 parent d13cb03 commit 4f89038
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ static int cpufreq_get_max_state(struct thermal_cooling_device *cdev,
struct cpufreq_cooling_device *cpufreq_device = cdev->devdata;
struct cpumask *mask = &cpufreq_device->allowed_cpus;
unsigned int cpu;
unsigned long count = 0;
unsigned int count = 0;
int ret;

cpu = cpumask_any(mask);

ret = get_property(cpu, 0, (unsigned int *)&count, GET_MAXL);
ret = get_property(cpu, 0, &count, GET_MAXL);

if (count > 0)
*state = count;
Expand Down

0 comments on commit 4f89038

Please sign in to comment.