aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/intel_menlow.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2008-11-14 11:29:12 +1100
committerJames Morris <jmorris@namei.org>2008-11-14 11:29:12 +1100
commit2b828925652340277a889cbc11b2d0637f7cdaf7 (patch)
tree32fcb3d3e466fc419fad2d3717956a5b5ad3d35a /drivers/misc/intel_menlow.c
parent3a3b7ce9336952ea7b9564d976d068a238976c9d (diff)
parent58e20d8d344b0ee083febb18c2b021d2427e56ca (diff)
downloadkernel_samsung_smdk4412-2b828925652340277a889cbc11b2d0637f7cdaf7.zip
kernel_samsung_smdk4412-2b828925652340277a889cbc11b2d0637f7cdaf7.tar.gz
kernel_samsung_smdk4412-2b828925652340277a889cbc11b2d0637f7cdaf7.tar.bz2
Merge branch 'master' into next
Conflicts: security/keys/internal.h security/keys/process_keys.c security/keys/request_key.c Fixed conflicts above by using the non 'tsk' versions. Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/misc/intel_menlow.c')
-rw-r--r--drivers/misc/intel_menlow.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c
index e00a275..27b7662 100644
--- a/drivers/misc/intel_menlow.c
+++ b/drivers/misc/intel_menlow.c
@@ -52,6 +52,11 @@ MODULE_LICENSE("GPL");
#define MEMORY_ARG_CUR_BANDWIDTH 1
#define MEMORY_ARG_MAX_BANDWIDTH 0
+/*
+ * GTHS returning 'n' would mean that [0,n-1] states are supported
+ * In that case max_cstate would be n-1
+ * GTHS returning '0' would mean that no bandwidth control states are supported
+ */
static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev,
unsigned long *max_state)
{
@@ -71,6 +76,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 +129,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;