Linux LED subsystem development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Steve Dunnagan <sdunnaga@redhat.com>
Cc: Pavel Machek <pavel@kernel.org>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Linus Walleij <linusw@kernel.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: gpio: Skip unavailable LEDs during shutdown
Date: Thu, 23 Jul 2026 12:35:32 +0100	[thread overview]
Message-ID: <20260723113532.GD3363113@google.com> (raw)
In-Reply-To: <20260710150841.19669-1-sdunnaga@redhat.com>

On Fri, 10 Jul 2026, Steve Dunnagan wrote:

> gpio_led_probe() leaves an error-valued GPIO descriptor in the LED
> data when an unavailable platform-data LED is skipped.

So why not nip that in the bud and fix that instead?

> The entry remains included in priv->num_leds, so gpio_led_shutdown()
> later passes the error pointer to gpio_led_set(), producing:
> 
> gpiod_set_value: invalid GPIO (errorpointer: -ENOENT)
> 
> Skip entries with error-valued GPIO descriptors during shutdown.
> 
> Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> Assisted-by: ChatGPT:GPT-5.5-Thinking
> Signed-off-by: Steve Dunnagan <sdunnaga@redhat.com>
> ---
>  drivers/leds/leds-gpio.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 8ae71c2e91e0..63cb517ef385 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -304,6 +304,9 @@ static void gpio_led_shutdown(struct platform_device *pdev)
>  	for (i = 0; i < priv->num_leds; i++) {
>  		struct gpio_led_data *led = &priv->leds[i];
>  
> +		if (IS_ERR(led->gpiod))
> +			continue;
> +
>  		if (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN))
>  			gpio_led_set(&led->cdev, LED_OFF);
>  	}
> -- 
> 2.49.0
> 

-- 
Lee Jones

  parent reply	other threads:[~2026-07-23 11:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 15:08 [PATCH] leds: gpio: Skip unavailable LEDs during shutdown Steve Dunnagan
2026-07-10 15:21 ` sashiko-bot
2026-07-23 11:35 ` Lee Jones [this message]
2026-07-24 18:04 ` [PATCH v2] leds: gpio: Clear error pointers for skipped LEDs Steve Dunnagan
2026-07-24 18:16   ` sashiko-bot
2026-07-25 14:02   ` Linus Walleij
2026-08-06 13:52   ` (subset) " Lee Jones
2026-08-13 15:45   ` Steve Dunnagan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260723113532.GD3363113@google.com \
    --to=lee@kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=sdunnaga@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox