diff options
author | Darren Hart (VMware) <dvhart@infradead.org> | 2017-04-19 21:11:33 -0400 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-04-20 16:26:18 -0400 |
commit | a055f9ecb5b4d0cb8b33ba664363a2ed7804a6c7 (patch) | |
tree | 01b87a06997ebe4fd8a4b26a205738ce7fc4d528 | |
parent | c21ee12f460c33fcc12fe162c9ab98f3c58073aa (diff) |
platform/x86: hp-wmi: Do not shadow errors in sysfs show functions
The new hp_wmi_read_int function returns a negative value in case of
error, pass this on directly rather than always replacing it with
-EINVAL.
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Tested-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index d1e3af23a147..e685018670c0 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -408,7 +408,7 @@ static ssize_t display_show(struct device *dev, struct device_attribute *attr, | |||
408 | { | 408 | { |
409 | int value = hp_wmi_read_int(HPWMI_DISPLAY_QUERY); | 409 | int value = hp_wmi_read_int(HPWMI_DISPLAY_QUERY); |
410 | if (value < 0) | 410 | if (value < 0) |
411 | return -EINVAL; | 411 | return value; |
412 | return sprintf(buf, "%d\n", value); | 412 | return sprintf(buf, "%d\n", value); |
413 | } | 413 | } |
414 | 414 | ||
@@ -417,7 +417,7 @@ static ssize_t hddtemp_show(struct device *dev, struct device_attribute *attr, | |||
417 | { | 417 | { |
418 | int value = hp_wmi_read_int(HPWMI_HDDTEMP_QUERY); | 418 | int value = hp_wmi_read_int(HPWMI_HDDTEMP_QUERY); |
419 | if (value < 0) | 419 | if (value < 0) |
420 | return -EINVAL; | 420 | return value; |
421 | return sprintf(buf, "%d\n", value); | 421 | return sprintf(buf, "%d\n", value); |
422 | } | 422 | } |
423 | 423 | ||
@@ -426,7 +426,7 @@ static ssize_t als_show(struct device *dev, struct device_attribute *attr, | |||
426 | { | 426 | { |
427 | int value = hp_wmi_read_int(HPWMI_ALS_QUERY); | 427 | int value = hp_wmi_read_int(HPWMI_ALS_QUERY); |
428 | if (value < 0) | 428 | if (value < 0) |
429 | return -EINVAL; | 429 | return value; |
430 | return sprintf(buf, "%d\n", value); | 430 | return sprintf(buf, "%d\n", value); |
431 | } | 431 | } |
432 | 432 | ||
@@ -435,7 +435,7 @@ static ssize_t dock_show(struct device *dev, struct device_attribute *attr, | |||
435 | { | 435 | { |
436 | int value = hp_wmi_hw_state(HPWMI_DOCK_MASK); | 436 | int value = hp_wmi_hw_state(HPWMI_DOCK_MASK); |
437 | if (value < 0) | 437 | if (value < 0) |
438 | return -EINVAL; | 438 | return value; |
439 | return sprintf(buf, "%d\n", value); | 439 | return sprintf(buf, "%d\n", value); |
440 | } | 440 | } |
441 | 441 | ||
@@ -444,7 +444,7 @@ static ssize_t tablet_show(struct device *dev, struct device_attribute *attr, | |||
444 | { | 444 | { |
445 | int value = hp_wmi_hw_state(HPWMI_TABLET_MASK); | 445 | int value = hp_wmi_hw_state(HPWMI_TABLET_MASK); |
446 | if (value < 0) | 446 | if (value < 0) |
447 | return -EINVAL; | 447 | return value; |
448 | return sprintf(buf, "%d\n", value); | 448 | return sprintf(buf, "%d\n", value); |
449 | } | 449 | } |
450 | 450 | ||
@@ -454,7 +454,7 @@ static ssize_t postcode_show(struct device *dev, struct device_attribute *attr, | |||
454 | /* Get the POST error code of previous boot failure. */ | 454 | /* Get the POST error code of previous boot failure. */ |
455 | int value = hp_wmi_read_int(HPWMI_POSTCODEERROR_QUERY); | 455 | int value = hp_wmi_read_int(HPWMI_POSTCODEERROR_QUERY); |
456 | if (value < 0) | 456 | if (value < 0) |
457 | return -EINVAL; | 457 | return value; |
458 | return sprintf(buf, "0x%x\n", value); | 458 | return sprintf(buf, "0x%x\n", value); |
459 | } | 459 | } |
460 | 460 | ||