summaryrefslogtreecommitdiffstats
path: root/drivers/misc/intel_menlow.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2008-09-11 10:56:00 +0800
committerLen Brown <len.brown@intel.com>2008-11-03 22:56:32 -0500
commitc2d06fe338912ee56c2ddd7de5574d5396ed8050 (patch)
tree6a7e6ad344135d6dca8c0d7984034995784fe233 /drivers/misc/intel_menlow.c
parent2830c9fb8e66cee70b8bffdfb0de01c144c7e643 (diff)
downloadop-kernel-dev-c2d06fe338912ee56c2ddd7de5574d5396ed8050.zip
op-kernel-dev-c2d06fe338912ee56c2ddd7de5574d5396ed8050.tar.gz
intel_menlow: don't set max_state a negative value
max_state is unsigned long. don't set max_state a negative value Cc : Thomas Sujith <sujith.thomas@intel.com> Cc : Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/intel_menlow.c')
-rw-r--r--drivers/misc/intel_menlow.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
index e00a275..124b37d 100644
--- a/drivers/misc/intel_menlow.c
+++ b/drivers/misc/intel_menlow.c
@@ -71,6 +71,9 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
if (ACPI_FAILURE(status))
return -EFAULT;
+ if (!value)
+ return -EINVAL;
+
*max_state = value - 1;
return 0;
}
@@ -121,7 +124,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
if (memory_get_int_max_bandwidth(cdev, &max_state))
return -EFAULT;
- if (max_state < 0 || state > max_state)
+ if (state > max_state)
return -EINVAL;
arg_list.count = 1;
OpenPOWER on IntegriCloud