diff options
| author | 2008-11-20 09:02:39 +0100 | |
|---|---|---|
| committer | 2008-11-20 09:02:39 +0100 | |
| commit | fbc2a06056c9aa3cb8c44bf1cfeb1d260e229e5c (patch) | |
| tree | feb2a1c13ad3dff5a8c7ab3c0265e8eca7a0c5a3 /drivers/misc/intel_menlow.c | |
| parent | x86, UV: fix redundant creation of sgi_uv (diff) | |
| parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 (diff) | |
| download | linux-dev-fbc2a06056c9aa3cb8c44bf1cfeb1d260e229e5c.tar.xz linux-dev-fbc2a06056c9aa3cb8c44bf1cfeb1d260e229e5c.zip | |
Merge branch 'linus' into x86/uv
Diffstat (limited to 'drivers/misc/intel_menlow.c')
| -rw-r--r-- | drivers/misc/intel_menlow.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c index e00a2756e97e..27b7662955bb 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; |
