leds: lm3532: Propagate enable GPIO errors
PATCH v3 1/2 leds: lm3532: Propagate enable GPIO errors
From: bui duc phuc <[email protected]>
devm_gpiod_get_optional() returns NULL when the optional GPIO is not present, but may return -EPROBE_DEFER or other errors.
lm3532_parse_node() currently treats GPIO lookup errors as if the GPIO were not present.
Check the return value and propagate errors from the enable GPIO lookup.
---
Link v1 :
https://lore.kernel.org/all/[email protected]/
Link v2 :
https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Capitalize the first letter of the commit message subject
drivers/leds/leds-lm3532.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/leds/leds-lm3532.c +2 -1
@@ -560,7 +560,8 @@ static int lm3532_parse_node(struct lm3532_data *priv) priv->enable_gpio =devm_gpiod_get_optional (&priv->client->dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (priv->enable_gpio)) - priv->enable_gpio =NULL ; +return dev_err_probe (&priv->client->dev,PTR_ERR (priv->enable_gpio), +"failed to get enable GPIO\n" );if (priv->enable_gpio) { ret =devm_add_action (&priv->client->dev, gpio_set_low_action, priv);
Signature · 1 line
2.43.0
PATCH v3 2/2 leds: lm3532: Avoid duplicate error messages
From: bui duc phuc <[email protected]>
Most error paths in lm3532_parse_node() already log errors. Remove the redundant error message from lm3532_probe() to avoid duplicate logs.
---
Link v1 :
https://lore.kernel.org/all/[email protected]/
Link v2 :
https://lore.kernel.org/all/[email protected]/
Changes in v3:
- Remove the error message for devm_add_action() failures.
drivers/leds/leds-lm3532.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/leds/leds-lm3532.c +1 -3
@@ -708,10 +708,8 @@ static int lm3532_probe(struct i2c_client *client)i2c_set_clientdata (client, drvdata); ret =lm3532_parse_node (drvdata); -if (ret) { -dev_err (&client->dev,"Failed to parse node\n" ); +if (ret)return ret; - }return ret; }
Signature · 1 line
2.43.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 5 lines
From: bui duc phuc <[email protected]>
devm_gpiod_get_optional()returns NULL when the optional GPIO is not present, but may return -EPROBE_DEFER or other errors.
Quoted 7 lines
lm3532_parse_node()currently treats GPIO lookup errors as if the GPIO were not present.Check the return value and propagate errors from the enable GPIO lookup.
Fixes bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver")Signed-off-by bui duc phuc <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages
In reply to [email protected]Sashiko has reviewed this patch and found no issues.
Quoted 7 lines
From: bui duc phuc <[email protected]>
Most error paths in
lm3532_parse_node()already log errors. Remove the redundant error message fromlm3532_probe()to avoid duplicate logs.Signed-off-by bui duc phuc <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Quoted 1 line · On Wed, 21 Oct 2026 11:58:31 +0700, [email protected]…
leds: lm3532: Propagate enable GPIO errors
Lee Jones
maintainerRe: [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages
In reply to [email protected]Quoted 25 lines · On Wed, 21 Oct 2026, [email protected] wrote:
From: bui duc phuc <[email protected]>
Most error paths in
lm3532_parse_node()already log errors. Remove the redundant error message fromlm3532_probe()to avoid duplicate logs.Signed-off-by bui duc phuc <[email protected]>---
Link v1 :
https://lore.kernel.org/all/[email protected]/
Link v2 :
https://lore.kernel.org/all/[email protected]/Changes in v3:
- Remove the error message fordevm_add_action()failures.drivers/leds/leds-lm3532.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/leds/leds-lm3532.c +0
-0
drivers/leds/leds-lm3532.c static int lm3532_probe(struct i2c_client *client) · line 714
Quoted 10 lines
drivers/leds/leds-lm3532.c +1
-3@@ -708,10 +708,8 @@ static int lm3532_probe(struct i2c_client *client)i2c_set_clientdata (client, drvdata); ret =lm3532_parse_node (drvdata); -if (ret) { -dev_err (&client->dev,"Failed to parse node\n" ); +if (ret)return ret; - }return ret;
As requested on v2, just:
return lm3532_parse_node(drvdata);
Quoted 5 lines
drivers/leds/leds-lm3532.c +0
-0}Signature · 1 line
2.43.0
Signature · 1 line
Lee Jones
Lee Jones
maintainerQuoted 30 lines · On Wed, 21 Oct 2026, [email protected] wrote:
From: bui duc phuc <[email protected]>
devm_gpiod_get_optional()returns NULL when the optional GPIO is not present, but may return -EPROBE_DEFER or other errors.
lm3532_parse_node()currently treats GPIO lookup errors as if the GPIO were not present.Check the return value and propagate errors from the enable GPIO lookup.
Fixes bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver")Signed-off-by bui duc phuc <[email protected]>---
Link v1 :
https://lore.kernel.org/all/[email protected]/
Link v2 :
https://lore.kernel.org/all/[email protected]/Changes in v2:
- Capitalize the first letter of the commit message subjectdrivers/leds/leds-lm3532.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/leds/leds-lm3532.c +0
-0
drivers/leds/leds-lm3532.c static int lm3532_parse_node(struct lm3532_data *priv) · line 564
Quoted 6 lines
drivers/leds/leds-lm3532.c +2
-1@@ -560,7 +560,8 @@ static int lm3532_parse_node(struct lm3532_data *priv) priv->enable_gpio =devm_gpiod_get_optional (&priv->client->dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (priv->enable_gpio)) - priv->enable_gpio =NULL ; +return dev_err_probe (&priv->client->dev,PTR_ERR (priv->enable_gpio), +"failed to get enable GPIO\n" )
Please capitalise the first letter of the error message.
Quoted 6 lines
drivers/leds/leds-lm3532.c +0
-0if (priv->enable_gpio) { ret =devm_add_action (&priv->client->dev, gpio_set_low_action, priv);Signature · 1 line
2.43.0
Signature · 1 line
Lee Jones