From: Soren Brinkmann Date: Sun, 1 Feb 2015 03:15:00 +0000 (-0800) Subject: leds: leds-gpio: Pass on error codes unmodified X-Git-Tag: firefly_0821_release~176^2~2330^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c6e71f813f7208d80bfe0f435d627fad1b204558;p=firefly-linux-kernel-4.4.55.git leds: leds-gpio: Pass on error codes unmodified Instead of overriding error codes, pass them on unmodified. This way a EPROBE_DEFER is correctly passed to the driver core. This results in the LED driver correctly requesting probe deferral in cases the GPIO controller is not yet available. Signed-off-by: Soren Brinkmann Reported-and-tested-by: Andreas Färber Signed-off-by: Bryan Wu --- diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 7ea1ea42c2d2..d26af0a79a90 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -187,6 +187,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) led.gpiod = devm_get_gpiod_from_child(dev, child); if (IS_ERR(led.gpiod)) { fwnode_handle_put(child); + ret = PTR_ERR(led.gpiod); goto err; } @@ -229,7 +230,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) err: for (count = priv->num_leds - 2; count >= 0; count--) delete_gpio_led(&priv->leds[count]); - return ERR_PTR(-ENODEV); + return ERR_PTR(ret); } static const struct of_device_id of_gpio_leds_match[] = {