thermal: pwm_fan: Fix coverity error
Anshul Jain [Sat, 12 Jan 2013 01:01:50 +0000 (17:01 -0800)]
Change-Id: I5976d9c01ef0b8b145ba6df182a72bafffbcc27d
Signed-off-by: Anshul Jain <anshulj@nvidia.com>
Reviewed-on: http://git-master/r/190794
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

drivers/thermal/pwm_fan.c

index 55ad4f3..5ad19ec 100644 (file)
@@ -78,9 +78,8 @@ static int fan_target_pwm_set(void *data, u64 val)
 
        if (!fan_data)
                return -EINVAL;
-       if (val < 0)
-               val = 0;
-       else if (val > fan_data->pwm_period)
+
+       if (val > fan_data->pwm_period)
                val = fan_data->pwm_period;
 
        mutex_lock(&fan_data->fan_state_lock);
@@ -127,9 +126,8 @@ static int fan_cap_pwm_set(void *data, u64 val)
 
        if (!fan_data)
                return -EINVAL;
-       if (val < 0)
-               val = 0;
-       else if (val > fan_data->pwm_period)
+
+       if (val > fan_data->pwm_period)
                val = fan_data->pwm_period;
        mutex_lock(&fan_data->fan_state_lock);
        fan_data->fan_cap_pwm = val * fan_data->precision_multiplier;