Commit e7431bd7 authored by Stefan Wahren's avatar Stefan Wahren Committed by Lee Jones

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: default avatarStefan Wahren <wahrenst@gmx.net>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231202183636.7055-1-wahrenst@gmx.netSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 78da55c8
...@@ -172,6 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev) ...@@ -172,6 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS, led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS,
NULL); NULL);
if (IS_ERR(led.gpiod)) { if (IS_ERR(led.gpiod)) {
dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n",
child);
fwnode_handle_put(child); fwnode_handle_put(child);
return ERR_CAST(led.gpiod); return ERR_CAST(led.gpiod);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment