]> Pileus Git - ~andy/linux/commitdiff
Thermal: cpufreq cooling: endian bug in cpufreq_get_max_state()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 17 Apr 2013 07:18:28 +0000 (07:18 +0000)
committerZhang Rui <rui.zhang@intel.com>
Wed, 17 Apr 2013 15:43:31 +0000 (23:43 +0800)
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>
drivers/thermal/cpu_cooling.c

index 5f5c780bcd9040e8ddd3e43fbb9e21e105d24224..768b508f0d69e814af847f97e7a884bf0ce2f9c9 100644 (file)
@@ -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;