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: <20211118122633.6069-1-luca@lucaceresoli.net>
Date:   Thu, 18 Nov 2021 13:26:33 +0100
From:   Luca Ceresoli <luca@...aceresoli.net>
To:     linux-kernel@...r.kernel.org
Cc:     Luca Ceresoli <luca@...aceresoli.net>,
        Lee Jones <lee.jones@...aro.org>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH] mfd: lp87565: fix error handling while getting reset GPIO

If devm_gpiod_get_optional() returns an error the driver code just goes on,
soon using a pointer that holds an error. The only exception is
-EPROBE_DEFER which is correctly handled.

Fix and also simplify code by always calling dev_err_probe().

Fixes: 50e4d7a2a667 ("mfd: lp87565: Handle optional reset pin")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Luca Ceresoli <luca@...aceresoli.net>
---
 drivers/mfd/lp87565.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/lp87565.c b/drivers/mfd/lp87565.c
index a52ab76febb3..f5890ce9ac8f 100644
--- a/drivers/mfd/lp87565.c
+++ b/drivers/mfd/lp87565.c
@@ -67,11 +67,9 @@ static int lp87565_probe(struct i2c_client *client,
 
 	lp87565->reset_gpio = devm_gpiod_get_optional(lp87565->dev, "reset",
 						      GPIOD_OUT_LOW);
-	if (IS_ERR(lp87565->reset_gpio)) {
-		ret = PTR_ERR(lp87565->reset_gpio);
-		if (ret == -EPROBE_DEFER)
-			return ret;
-	}
+	if (IS_ERR(lp87565->reset_gpio))
+		return dev_err_probe(lp87565->dev, PTR_ERR(lp87565->reset_gpio),
+				     "Failed getting reset GPIO");
 
 	if (lp87565->reset_gpio) {
 		gpiod_set_value_cansleep(lp87565->reset_gpio, 1);
-- 
2.34.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ