mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
hwmon: (emc2103) Fix return value
kstrtol() returns appropriate error values. Use those instead of hardcoding. Silences several sparse messages of following type: "why not propagate 'result' from kstrtol() instead of (-22)?" Signed-off-by: Sachin Kamat <[email protected]> Cc: Steve Glendinning <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
parent
a22a0fdba4
commit
1a3abbd0b9
1 changed files with 5 additions and 5 deletions
|
|
@ -248,7 +248,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da,
|
|||
|
||||
int result = kstrtol(buf, 10, &val);
|
||||
if (result < 0)
|
||||
return -EINVAL;
|
||||
return result;
|
||||
|
||||
val = DIV_ROUND_CLOSEST(val, 1000);
|
||||
if ((val < -63) || (val > 127))
|
||||
|
|
@ -272,7 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da,
|
|||
|
||||
int result = kstrtol(buf, 10, &val);
|
||||
if (result < 0)
|
||||
return -EINVAL;
|
||||
return result;
|
||||
|
||||
val = DIV_ROUND_CLOSEST(val, 1000);
|
||||
if ((val < -63) || (val > 127))
|
||||
|
|
@ -320,7 +320,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da,
|
|||
|
||||
int status = kstrtol(buf, 10, &new_div);
|
||||
if (status < 0)
|
||||
return -EINVAL;
|
||||
return status;
|
||||
|
||||
if (new_div == old_div) /* No change */
|
||||
return count;
|
||||
|
|
@ -394,7 +394,7 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da,
|
|||
|
||||
int result = kstrtol(buf, 10, &rpm_target);
|
||||
if (result < 0)
|
||||
return -EINVAL;
|
||||
return result;
|
||||
|
||||
/* Datasheet states 16384 as maximum RPM target (table 3.2) */
|
||||
if ((rpm_target < 0) || (rpm_target > 16384))
|
||||
|
|
@ -440,7 +440,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da,
|
|||
|
||||
int result = kstrtol(buf, 10, &new_value);
|
||||
if (result < 0)
|
||||
return -EINVAL;
|
||||
return result;
|
||||
|
||||
mutex_lock(&data->update_lock);
|
||||
switch (new_value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue