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-next>] [day] [month] [year] [list]
Message-Id: <20221004064521.498510-1-usama.anjum@collabora.com>
Date:   Tue,  4 Oct 2022 11:45:21 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     Sebastian Reichel <sre@...nel.org>
Cc:     Muhammad Usama Anjum <usama.anjum@...labora.com>,
        kernel@...labora.com, kernel-janitors@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] power: supply: remove less-than-zero comparison of unsigned variables

max_chg_vol_reg and max_chg_cur_reg are unsigned variables. The
less-than-zero comparison of an unsigned value is never true. Remove
these checks.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
 drivers/power/supply/rk817_charger.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
index 635f051b0821..aa4b33f1bb83 100644
--- a/drivers/power/supply/rk817_charger.c
+++ b/drivers/power/supply/rk817_charger.c
@@ -951,12 +951,12 @@ static int rk817_battery_init(struct rk817_charger *charger,
 
 	max_chg_cur_reg = rk817_chg_cur_to_reg(max_chg_cur_ma);
 
-	if (max_chg_vol_reg < 0 || max_chg_vol_reg > 7) {
+	if (max_chg_vol_reg > 7) {
 		return dev_err_probe(charger->dev, -EINVAL,
 		       "invalid max charger voltage, value %u unsupported\n",
 		       max_chg_vol_mv * 1000);
 	}
-	if (max_chg_cur_reg < 0 || max_chg_cur_reg > 7) {
+	if (max_chg_cur_reg > 7) {
 		return dev_err_probe(charger->dev, -EINVAL,
 		       "invalid max charger current, value %u unsupported\n",
 		       max_chg_cur_ma * 1000);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ