summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2015-04-16 10:30:50 +0300
committerBryan Wu <cooloney@gmail.com>2015-05-04 21:05:55 +0300
commit0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731 (patch)
tree4c90be2e36cd4fd4874cc6e9e6f867028547720b
parent65c6b7e3ab70effc150dacc9c2fbd6581925dd53 (diff)
downloadlinux-0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731.tar.xz
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>
-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);