Re: [PATCH v2 1/2] leds: lm3532: Propagate enable GPIO errors
From: Lee Jones
Date: Tue Oct 13 2026 - 04:37:42 EST
On Fri, 09 Oct 2026, phucduc.bui@xxxxxxxxx wrote:
> From: bui duc phuc <phucduc.bui@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ---
>
> 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");
This changes the semantics of the GPIO handling.
Currently we treat the GPIO as optional, regardless of what is returned.
Ideally we'd have the author review this - did you Cc them?
> if (priv->enable_gpio) {
> ret = devm_add_action(&priv->client->dev, gpio_set_low_action, priv);
> --
> 2.43.0
>
--
Lee Jones