The error codes for ACPI failures when setting battery start and stop
thresholds were gobbling the real error code and also inconsistent.

Signed-off-by: Thomas Weißschuh <li...@weissschuh.net>
---
 drivers/platform/x86/thinkpad_acpi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c 
b/drivers/platform/x86/thinkpad_acpi.c
index 1fc6a667dbd4..cb20b3817e36 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -9474,8 +9474,9 @@ static ssize_t tpacpi_battery_store(int what,
                        return -EINVAL;
                if (value > battery_info.batteries[battery].charge_stop)
                        return -EINVAL;
-               if (tpacpi_battery_set(THRESHOLD_START, battery, value))
-                       return -ENODEV;
+               rval = tpacpi_battery_set(THRESHOLD_START, battery, value);
+               if (rval)
+                       return rval;
                battery_info.batteries[battery].charge_start = value;
                return count;
 
@@ -9495,8 +9496,9 @@ static ssize_t tpacpi_battery_store(int what,
                 */
                if (value == 100)
                        value = 0;
-               if (tpacpi_battery_set(THRESHOLD_STOP, battery, value))
-                       return -EINVAL;
+               rval = tpacpi_battery_set(THRESHOLD_STOP, battery, value);
+               if (rval)
+                       return rval;
                return count;
        default:
                pr_crit("Wrong parameter: %d", what);
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel

Reply via email to