summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-03-07 14:57:36 +0300
committerLen Brown <len.brown@intel.com>2012-03-30 16:06:12 -0400
commit344e222edf486bf42da1ced137e36df7a345b0ad (patch)
tree6999f131dc4ac8b6a022ffb5b127c4eb0421cb7b /drivers/acpi
parentc264c651fd318274ffe27219947f17f24f07c073 (diff)
ACPI throttling: fix endian bug in acpi_read_throttling_status()
Using a u64 here creates an endian bug. We store a u32 number in the top byte which is a larger number than intended on big endian systems. There is no reason to use a 64 bit data type here, I guess it was just an oversight. I removed the initialization to zero as well. It's needed with a u64 but with a u32, the variable gets initialized properly inside the call to acpi_os_read_port(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/processor_throttling.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 605a2954ef17..1d02b7b5ade0 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -769,7 +769,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
u64 *value)
{
u32 bit_width, bit_offset;
- u64 ptc_value;
+ u32 ptc_value;
u64 ptc_mask;
struct acpi_processor_throttling *throttling;
int ret = -1;
@@ -777,12 +777,11 @@ static int acpi_read_throttling_status(struct acpi_processor *pr,
throttling = &pr->throttling;
switch (throttling->status_register.space_id) {
case ACPI_ADR_SPACE_SYSTEM_IO:
- ptc_value = 0;
bit_width = throttling->status_register.bit_width;
bit_offset = throttling->status_register.bit_offset;
acpi_os_read_port((acpi_io_address) throttling->status_register.
- address, (u32 *) &ptc_value,
+ address, &ptc_value,
(u32) (bit_width + bit_offset));
ptc_mask = (1 << bit_width) - 1;
*value = (u64) ((ptc_value >> bit_offset) & ptc_mask);