summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAyman Bagabas <ayman.bagabas@gmail.com>2019-10-20 13:00:07 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-10-21 12:17:30 +0300
commit7c675486b97afea710f4c11ca71cb228c1e671be (patch)
treee0e05ccc6bae63bee7085bcd2db7fb2ab59d8eb1 /drivers/platform
parentd3f5b7366a4af088bc73be67835d2a394e2ce2e0 (diff)
platform/x86: huawei-wmi: Stricter battery thresholds set
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> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/huawei-wmi.c2
1 files changed, 1 insertions, 1 deletions
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;