Re: [PATCH v2] leds: gpio: Clear error pointers for skipped LEDs
[email protected] Fri, 24 Jul 2026 18:16:07 +0000
| Newsgroups | org.kernel.vger.linux-leds |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] The driver masks -EPROBE_DEFER from GPIO fetching functions and incorrectly skips the LED instead of deferring the probe. -- --- Patch [1]: [PATCH v2] leds: gpio: Clear error pointers for skipped LEDs --- commit 2d09674f074f178fbc54110548c9a0816564760c Author: Steve Dunnagan <[email protected]> leds: gpio: Clear error pointers for skipped LEDs When an LED's GPIO is unavailable, the error pointer is left in led_dat->gpiod. During shutdown this error pointer is passed to gpio_led_set(), producing an invalid GPIO warning. This commit clears the error pointer to prevent the warning. > diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c > index 8ae71c2e91e01..8810fdcf2d774 100644 > --- a/drivers/leds/leds-gpio.c > +++ b/drivers/leds/leds-gpio.c > @@ -277,6 +277,7 @@ static int gpio_led_probe(struct platform_device *pdev) > if (IS_ERR(led_dat->gpiod)) { > dev_info(dev, "Skipping unavailable LED gpio %d (%s)\n", > template->gpio, template->name); [Severity: High] This isn't a bug introduced by this patch, but does this unconditionally skip the LED even if gpio_led_get_gpiod() returns -EPROBE_DEFER? If the GPIO controller providing the LED pins hasn't probed yet, gpio_led_get_gpiod() returns ERR_PTR(-EPROBE_DEFER) to gpio_led_probe(). By catching all error pointers with IS_ERR() here and continuing, the driver completes the probe without the deferred LED instead of actually deferring, permanently breaking the LED's functionality. Would it be better to use dev_err_probe() here to correctly handle -EPROBE_DEFER? > + led_dat->gpiod = NULL; > continue; > } > -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1