mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set
@ 2019-10-20 17:00 Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
  2019-10-20 17:00 ` [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex Ayman Bagabas
  0 siblings, 2 replies; 3+ messages in thread
From: Ayman Bagabas @ 2019-10-20 17:00 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko, Ayman Bagabas, Takashi Iwai,
	Mattias Jacobsson, kbuild test robot, Dan Carpenter,
	platform-driver-x86, linux-kernel

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(-)

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;

base-commit: c4b9850b3676869ac0def5885d781d17f64b3a86
-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-20 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20 17:00 [PATCH 1/3] platform/x86: huawei-wmi: Stricter battery thresholds set Ayman Bagabas
2019-10-20 17:00 ` [PATCH 2/3] platform/x86: huawei-wmi: No need to check for battery name Ayman Bagabas
2019-10-20 17:00 ` [PATCH 3/3] platform/x86: huawei-wmi: Remove unnecessary battery mutex Ayman Bagabas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®