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>] [day] [month] [year] [list]
Message-ID: <20221115090927.47143-1-wupeng58@huawei.com>
Date:   Tue, 15 Nov 2022 09:09:27 +0000
From:   Peng Wu <wupeng58@...wei.com>
To:     <sboyd@...nel.org>, <vkoul@...nel.org>, <collinsd@...eaurora.org>,
        <andersson@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <liwei391@...wei.com>,
        Peng Wu <wupeng58@...wei.com>
Subject: [PATCH -next] spmi: pmic-arb: fix a NULL vs IS_ERR() check in spmi_pmic_arb_probe()

The devm_ioremap() function returns NULL on error, it doesn't return
error pointers.

Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
Signed-off-by: Peng Wu <wupeng58@...wei.com>
---
 drivers/spmi/spmi-pmic-arb.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 8b6a42ab816f..c5b5ea0519c1 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -1462,8 +1462,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	 */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
 	core = devm_ioremap(&ctrl->dev, res->start, resource_size(res));
-	if (IS_ERR(core)) {
-		err = PTR_ERR(core);
+	if (!core) {
+		err = -ENOMEM;
 		goto err_put_ctrl;
 	}
 
@@ -1499,8 +1499,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 						   "obsrvr");
 		pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start,
 						 resource_size(res));
-		if (IS_ERR(pmic_arb->rd_base)) {
-			err = PTR_ERR(pmic_arb->rd_base);
+		if (!pmic_arb->rd_base) {
+			err = -ENOMEM;
 			goto err_put_ctrl;
 		}
 
@@ -1508,8 +1508,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 						   "chnls");
 		pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start,
 						 resource_size(res));
-		if (IS_ERR(pmic_arb->wr_base)) {
-			err = PTR_ERR(pmic_arb->wr_base);
+		if (!pmic_arb->wr_base) {
+			err = -ENOMEM;
 			goto err_put_ctrl;
 		}
 	}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ