]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
intel_menlow: don't set max_state a negative value
authorZhang Rui <rui.zhang@intel.com>
Thu, 11 Sep 2008 02:56:00 +0000 (10:56 +0800)
committerLen Brown <len.brown@intel.com>
Tue, 4 Nov 2008 03:56:32 +0000 (22:56 -0500)
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>
drivers/misc/intel_menlow.c

index e00a2756e97e110654387efec263855a0cd5aaa3..124b37ddb5c17b335b103548c2f7da4a475b26f3 100644 (file)
@@ -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;