[PATCH] thinkpad_acpi: use consistent return values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <linux@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel




[Index of Archives]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite Photos]     [Yosemite Advice]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux