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>
This commit is contained in:
parent
65c6b7e3ab
commit
0e14e0bfe8
|
@ -198,8 +198,10 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
|
||||||
} else {
|
} else {
|
||||||
if (IS_ENABLED(CONFIG_OF) && !led.name && np)
|
if (IS_ENABLED(CONFIG_OF) && !led.name && np)
|
||||||
led.name = np->name;
|
led.name = np->name;
|
||||||
if (!led.name)
|
if (!led.name) {
|
||||||
return ERR_PTR(-EINVAL);
|
ret = -EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fwnode_property_read_string(child, "linux,default-trigger",
|
fwnode_property_read_string(child, "linux,default-trigger",
|
||||||
&led.default_trigger);
|
&led.default_trigger);
|
||||||
|
|
Loading…
Reference in New Issue