summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2015-04-16 00:30:50 -0700
committerBryan Wu <cooloney@gmail.com>2015-05-04 11:05:55 -0700
commit0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731 (patch)
tree4c90be2e36cd4fd4874cc6e9e6f867028547720b /drivers/leds
parent65c6b7e3ab70effc150dacc9c2fbd6581925dd53 (diff)
downloadlinux-0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731.tar.bz2
leds: gpio: Fix error handling for led name null pointer case
Make sure that already registered LEDs will be torn down properly if the name of the next LED to create is unavailable. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 25df4a240972..c3db74a1aba7 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -198,8 +198,10 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
} else {
if (IS_ENABLED(CONFIG_OF) && !led.name && np)
led.name = np->name;
- if (!led.name)
- return ERR_PTR(-EINVAL);
+ if (!led.name) {
+ ret = -EINVAL;
+ goto err;
+ }
}
fwnode_property_read_string(child, "linux,default-trigger",
&led.default_trigger);