lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241208-cros_charge-control-v2-v1-2-8d168d0f08a3@weissschuh.net>
Date: Sun, 08 Dec 2024 15:59:27 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Thomas Weißschuh <thomas@...ssschuh.net>, 
 Benson Leung <bleung@...omium.org>, Guenter Roeck <groeck@...omium.org>, 
 Sebastian Reichel <sre@...nel.org>, Tzung-Bi Shih <tzungbi@...nel.org>
Cc: Thomas Koch <linrunner@....net>, 
 Sebastian Reichel <sebastian.reichel@...labora.com>, 
 chrome-platform@...ts.linux.dev, linux-pm@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 Thomas Weißschuh <linux@...ssschuh.net>, 
 stable@...r.kernel.org
Subject: [PATCH 2/3] power: supply: cros_charge-control: allow
 start_threshold == end_threshold

Allow setting the start and stop thresholds to the same value.
There is no reason to disallow it.

Suggested-by: Thomas Koch <linrunner@....net>
Fixes: c6ed48ef5259 ("power: supply: add ChromeOS EC based charge control driver")
Cc: stable@...r.kernel.org
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 drivers/power/supply/cros_charge-control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c
index 58ca6d9ed6132af63a36ea4c5bf212acf066936c..108b121db4423187fb65548396fb9195b8801006 100644
--- a/drivers/power/supply/cros_charge-control.c
+++ b/drivers/power/supply/cros_charge-control.c
@@ -139,11 +139,11 @@ static ssize_t cros_chctl_store_threshold(struct device *dev, struct cros_chctl_
 		return -EINVAL;
 
 	if (is_end_threshold) {
-		if (val <= priv->current_start_threshold)
+		if (val < priv->current_start_threshold)
 			return -EINVAL;
 		priv->current_end_threshold = val;
 	} else {
-		if (val >= priv->current_end_threshold)
+		if (val > priv->current_end_threshold)
 			return -EINVAL;
 		priv->current_start_threshold = val;
 	}

-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ