diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-11 00:19:48 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-09-11 16:01:31 -0400 |
commit | 1a3abbd0b9a16e40fd4718f99896c437a193c0a1 (patch) | |
tree | 860969b3af4d7b561caa11a46ce51b1c06589dc9 /drivers/hwmon | |
parent | a22a0fdba4191473581f86c9dd5361cf581521d3 (diff) |
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 <sachin.kamat@linaro.org>
Cc: Steve Glendinning <steve.glendinning@shawell.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/emc2103.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index b07305622087..2c137b26acb4 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c | |||
@@ -248,7 +248,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, | |||
248 | 248 | ||
249 | int result = kstrtol(buf, 10, &val); | 249 | int result = kstrtol(buf, 10, &val); |
250 | if (result < 0) | 250 | if (result < 0) |
251 | return -EINVAL; | 251 | return result; |
252 | 252 | ||
253 | val = DIV_ROUND_CLOSEST(val, 1000); | 253 | val = DIV_ROUND_CLOSEST(val, 1000); |
254 | if ((val < -63) || (val > 127)) | 254 | if ((val < -63) || (val > 127)) |
@@ -272,7 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da, | |||
272 | 272 | ||
273 | int result = kstrtol(buf, 10, &val); | 273 | int result = kstrtol(buf, 10, &val); |
274 | if (result < 0) | 274 | if (result < 0) |
275 | return -EINVAL; | 275 | return result; |
276 | 276 | ||
277 | val = DIV_ROUND_CLOSEST(val, 1000); | 277 | val = DIV_ROUND_CLOSEST(val, 1000); |
278 | if ((val < -63) || (val > 127)) | 278 | if ((val < -63) || (val > 127)) |
@@ -320,7 +320,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da, | |||
320 | 320 | ||
321 | int status = kstrtol(buf, 10, &new_div); | 321 | int status = kstrtol(buf, 10, &new_div); |
322 | if (status < 0) | 322 | if (status < 0) |
323 | return -EINVAL; | 323 | return status; |
324 | 324 | ||
325 | if (new_div == old_div) /* No change */ | 325 | if (new_div == old_div) /* No change */ |
326 | return count; | 326 | return count; |
@@ -394,7 +394,7 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, | |||
394 | 394 | ||
395 | int result = kstrtol(buf, 10, &rpm_target); | 395 | int result = kstrtol(buf, 10, &rpm_target); |
396 | if (result < 0) | 396 | if (result < 0) |
397 | return -EINVAL; | 397 | return result; |
398 | 398 | ||
399 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ | 399 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ |
400 | if ((rpm_target < 0) || (rpm_target > 16384)) | 400 | if ((rpm_target < 0) || (rpm_target > 16384)) |
@@ -440,7 +440,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, | |||
440 | 440 | ||
441 | int result = kstrtol(buf, 10, &new_value); | 441 | int result = kstrtol(buf, 10, &new_value); |
442 | if (result < 0) | 442 | if (result < 0) |
443 | return -EINVAL; | 443 | return result; |
444 | 444 | ||
445 | mutex_lock(&data->update_lock); | 445 | mutex_lock(&data->update_lock); |
446 | switch (new_value) { | 446 | switch (new_value) { |