summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAnshul Jain <anshulj@nvidia.com>2013-01-11 17:01:50 -0800
committerRiham Haidar <rhaidar@nvidia.com>2013-01-15 17:17:44 -0800
commit7a4ef61fa5258b3e31084165313c2784124f2748 (patch)
tree87f9b3304600b1093c4cc1d866c0e8cc7d51c193 /drivers/thermal
parent04dd8631fed1b90dfa2a57138c21fe7fc73deacd (diff)
thermal: pwm_fan: Fix coverity error
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>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/pwm_fan.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/thermal/pwm_fan.c b/drivers/thermal/pwm_fan.c
index 55ad4f359353..5ad19ecf7655 100644
--- a/drivers/thermal/pwm_fan.c
+++ b/drivers/thermal/pwm_fan.c
@@ -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;