Skip to content

Commit e7431bd

Browse files
lategoodbyelag-linaro
authored andcommitted
leds: gpio: Add kernel log if devm_fwnode_gpiod_get() fails
In case leds-gpio fails to get at least one of possibly many GPIOs from the DT (e.g. the GPIO is already requested) neither gpiolib nor the driver does provide any helpful error log: leds-gpio: probe of leds failed with error -16 As the driver knows better how to handle errors with such mandatory GPIOs, let's implement an error log which points to the affected GPIO. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20231202183636.7055-1-wahrenst@gmx.net Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 78da55c commit e7431bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/leds/leds-gpio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
172172
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS,
173173
NULL);
174174
if (IS_ERR(led.gpiod)) {
175+
dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n",
176+
child);
175177
fwnode_handle_put(child);
176178
return ERR_CAST(led.gpiod);
177179
}

0 commit comments

Comments
 (0)