* [PATCH] leds: gpio: Skip unavailable LEDs during shutdown
@ 2026-07-10 15:08 Steve Dunnagan
0 siblings, 0 replies; only message in thread
From: Steve Dunnagan @ 2026-07-10 15:08 UTC (permalink / raw)
To: Lee Jones, Pavel Machek
Cc: Jacek Anaszewski, Linus Walleij, linux-leds, linux-kernel
gpio_led_probe() leaves an error-valued GPIO descriptor in the LED
data when an unavailable platform-data LED is skipped.
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-10 15:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 15:08 [PATCH] leds: gpio: Skip unavailable LEDs during shutdown Steve Dunnagan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox