summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2015-04-16 09:30:50 +0200
committerBryan Wu <cooloney@gmail.com>2015-05-04 20:05:55 +0200
commit0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731 (patch)
tree4c90be2e36cd4fd4874cc6e9e6f867028547720b /drivers/leds/leds-gpio.c
parentleds: gpio: Fix device teardown on probe deferral (diff)
downloadlinux-0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731.tar.xz
linux-0e14e0bfe85dd22ba19446bdfdc2cf0e941b9731.zip
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/leds-gpio.c')
-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);