提交 0b4634fc 编写于 作者: D Dmitry Eremin-Solenikov 提交者: Richard Purdie

leds-gpio: fix possible crash on OF device unbinding

If there are leds present in the OF tree, but the GPIOs for (some) of
them are unavailable, led_data doesn't get populated with correct
devices. Then, on device unbinding, one can crash the kernel.

Workaround this by setting led->gpio to invalid value early.
Signed-off-by: NDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: NRichard Purdie <rpurdie@linux.intel.com>
上级 716bdf18
......@@ -78,6 +78,8 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
{
int ret, state;
led_dat->gpio = -1;
/* skip leds that aren't available */
if (!gpio_is_valid(template->gpio)) {
printk(KERN_INFO "Skipping unavailable LED gpio %d (%s)\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册