diff mbox series

[1/3] platform/x86: huawei-wmi: Stricter battery thresholds set

Message ID 20191020170020.26251-1-ayman.bagabas@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/3] platform/x86: huawei-wmi: Stricter battery thresholds set | expand

Commit Message

Ayman Bagabas Oct. 20, 2019, 5 p.m. UTC
Check if battery thresholds are within 0 and 100.

Fixes: 355a070b09ab ("platform/x86: huawei-wmi: Add battery charging thresholds")
Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
---
 drivers/platform/x86/huawei-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: c4b9850b3676869ac0def5885d781d17f64b3a86
diff mbox series

Patch

diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 5837d1b8693d..26041d44286a 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -345,7 +345,7 @@  static int huawei_wmi_battery_set(int start, int end)
 	union hwmi_arg arg;
 	int err;
 
-	if (start < 0 || end > 100)
+	if (start < 0 || end < 0 || start > 100 || end > 100)
 		return -EINVAL;
 
 	arg.cmd = BATTERY_THRESH_SET;