mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors
@ 2026-10-21  4:58 phucduc.bui
  2026-10-21  4:58 ` [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages phucduc.bui
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: phucduc.bui @ 2026-10-21  4:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, linux-leds, linux-kernel
  Cc: Jacek Anaszewski, Dan Murphy, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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 <phucduc.bui@gmail.com>
---

Link v1 : 
https://lore.kernel.org/all/20261007104915.507801-1-phucduc.bui@gmail.com/
Link v2 : 
https://lore.kernel.org/all/20261009091059.25729-1-phucduc.bui@gmail.com/

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(-)

diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
index b51496910b08..a3bc9680dc4c 100644
--- a/drivers/leds/leds-lm3532.c
+++ b/drivers/leds/leds-lm3532.c
@@ -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);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages
  2026-10-21  4:58 [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors phucduc.bui
@ 2026-10-21  4:58 ` phucduc.bui
  2026-11-13 11:20   ` Lee Jones
  2026-10-30 12:59 ` [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors Griffin Kroah-Hartman
  2026-11-13 11:21 ` Lee Jones
  2 siblings, 1 reply; 5+ messages in thread
From: phucduc.bui @ 2026-10-21  4:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, linux-leds, linux-kernel
  Cc: Jacek Anaszewski, Dan Murphy, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

Most error paths in lm3532_parse_node() already log errors. Remove
the redundant error message from lm3532_probe() to avoid duplicate
logs.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Link v1 : 
https://lore.kernel.org/all/20261007104915.507801-1-phucduc.bui@gmail.com/
Link v2 : 
https://lore.kernel.org/all/20261009091059.25729-1-phucduc.bui@gmail.com/

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(-)

diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
index a3bc9680dc4c..a050e4350bdb 100644
--- a/drivers/leds/leds-lm3532.c
+++ b/drivers/leds/leds-lm3532.c
@@ -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;
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors
  2026-10-21  4:58 [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors phucduc.bui
  2026-10-21  4:58 ` [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages phucduc.bui
@ 2026-10-30 12:59 ` Griffin Kroah-Hartman
  2026-11-13 11:21 ` Lee Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Griffin Kroah-Hartman @ 2026-10-30 12:59 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Lee Jones, Pavel Machek, linux-leds, linux-kernel,
	Jacek Anaszewski, Dan Murphy

On Wed, 21 Oct 2026 11:58:31 +0700, phucduc.bui@gmail.com <phucduc.bui@gmail.com> wrote:
> leds: lm3532: Propagate enable GPIO errors

Reviewed-by: Griffin Kroah-Hartman <griffin@kroah.com>

-- 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages
  2026-10-21  4:58 ` [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages phucduc.bui
@ 2026-11-13 11:20   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2026-11-13 11:20 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Pavel Machek, linux-leds, linux-kernel, Jacek Anaszewski, Dan Murphy

On Wed, 21 Oct 2026, phucduc.bui@gmail.com wrote:

> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Most error paths in lm3532_parse_node() already log errors. Remove
> the redundant error message from lm3532_probe() to avoid duplicate
> logs.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
>
> Link v1 : 
> https://lore.kernel.org/all/20261007104915.507801-1-phucduc.bui@gmail.com/
> Link v2 : 
> https://lore.kernel.org/all/20261009091059.25729-1-phucduc.bui@gmail.com/
>
> 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(-)
>
> diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
> index a3bc9680dc4c..a050e4350bdb 100644
> --- a/drivers/leds/leds-lm3532.c
> +++ b/drivers/leds/leds-lm3532.c
> @@ -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);

>  }
> -- 
> 2.43.0
>
>

-- 
Lee Jones

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors
  2026-10-21  4:58 [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors phucduc.bui
  2026-10-21  4:58 ` [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages phucduc.bui
  2026-10-30 12:59 ` [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors Griffin Kroah-Hartman
@ 2026-11-13 11:21 ` Lee Jones
  2 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2026-11-13 11:21 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Pavel Machek, linux-leds, linux-kernel, Jacek Anaszewski, Dan Murphy

On Wed, 21 Oct 2026, phucduc.bui@gmail.com wrote:

> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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 <phucduc.bui@gmail.com>
> ---
>
> Link v1 : 
> https://lore.kernel.org/all/20261007104915.507801-1-phucduc.bui@gmail.com/
> Link v2 : 
> https://lore.kernel.org/all/20261009091059.25729-1-phucduc.bui@gmail.com/
>
> 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(-)
>
> diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c
> index b51496910b08..a3bc9680dc4c 100644
> --- a/drivers/leds/leds-lm3532.c
> +++ b/drivers/leds/leds-lm3532.c
> @@ -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.

>  	if (priv->enable_gpio) {
>  		ret = devm_add_action(&priv->client->dev, gpio_set_low_action, priv);
> -- 
> 2.43.0
>
>

-- 
Lee Jones

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-13 11:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21  4:58 [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors phucduc.bui
2026-10-21  4:58 ` [PATCH v3 2/2] leds: lm3532: Avoid duplicate error messages phucduc.bui
2026-11-13 11:20   ` Lee Jones
2026-10-30 12:59 ` [PATCH v3 1/2] leds: lm3532: Propagate enable GPIO errors Griffin Kroah-Hartman
2026-11-13 11:21 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®