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: <20210720061836.29148-1-tangbin@cmss.chinamobile.com>
Date:   Tue, 20 Jul 2021 14:18:36 +0800
From:   Tang Bin <tangbin@...s.chinamobile.com>
To:     sre@...nel.org
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Tang Bin <tangbin@...s.chinamobile.com>,
        Zhang Shengju <zhangshengju@...s.chinamobile.com>
Subject: [PATCH] power: supply: cpcap-battery: Use IS_ERR() to check and simplify code

Use IS_ERR() and PTR_ERR() instead of PTR_ERR_OR_ZERO() to
simplify code, avoid redundant judgements.

Signed-off-by: Zhang Shengju <zhangshengju@...s.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@...s.chinamobile.com>
---
 drivers/power/supply/cpcap-battery.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
index 90eba3646..7007e5d53 100644
--- a/drivers/power/supply/cpcap-battery.c
+++ b/drivers/power/supply/cpcap-battery.c
@@ -912,10 +912,9 @@ static int cpcap_battery_probe(struct platform_device *pdev)
 
 	ddata->psy = devm_power_supply_register(ddata->dev, psy_desc,
 						&psy_cfg);
-	error = PTR_ERR_OR_ZERO(ddata->psy);
-	if (error) {
+	if (IS_ERR(ddata->psy)) {
 		dev_err(ddata->dev, "failed to register power supply\n");
-		return error;
+		return PTR_ERR(ddata->psy);
 	}
 
 	atomic_set(&ddata->active, 1);
-- 
2.20.1.windows.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ