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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <22e1f8245251f0ec297881942abfa2b00eff48d2.1618126878.git.christophe.jaillet@wanadoo.fr>
Date:   Sun, 11 Apr 2021 09:45:30 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     pavel@....cz, mallikarjunax.reddy@...ux.intel.com
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH 1/2] leds: lgm: Propagate error codes to the caller

Do not always return -EINVAL in case of error in '__sso_led_dt_parse()'.
Propagate the error code instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 drivers/leds/blink/leds-lgm-sso.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/blink/leds-lgm-sso.c b/drivers/leds/blink/leds-lgm-sso.c
index 7d5c9ca007d6..3da242d4ce7d 100644
--- a/drivers/leds/blink/leds-lgm-sso.c
+++ b/drivers/leds/blink/leds-lgm-sso.c
@@ -643,6 +643,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
 							      GPIOD_ASIS, NULL);
 		if (IS_ERR(led->gpiod)) {
 			dev_err(dev, "led: get gpio fail!\n");
+			ret = PTR_ERR(led->gpiod);
 			goto __dt_err;
 		}
 
@@ -664,6 +665,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
 		ret = fwnode_property_read_u32(fwnode_child, "reg", &prop);
 		if (ret != 0 || prop >= SSO_LED_MAX_NUM) {
 			dev_err(dev, "invalid LED pin:%u\n", prop);
+			ret = ret ? ret : -EINVAL;
 			goto __dt_err;
 		}
 		desc->pin = prop;
@@ -699,8 +701,10 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
 				desc->brightness = LED_FULL;
 		}
 
-		if (sso_create_led(priv, led, fwnode_child))
+		if (sso_create_led(priv, led, fwnode_child)) {
+			ret = -EINVAL;
 			goto __dt_err;
+		}
 	}
 	fwnode_handle_put(fw_ssoled);
 
@@ -713,7 +717,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
 		sso_led_shutdown(led);
 	}
 
-	return -EINVAL;
+	return ret;
 }
 
 static int sso_led_dt_parse(struct sso_led_priv *priv)
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ