提交 0e14e0bf 编写于 作者: J Jacek Anaszewski 提交者: Bryan Wu

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: NJacek Anaszewski <j.anaszewski@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: NBryan Wu <cooloney@gmail.com>
上级 65c6b7e3
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册