mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
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: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
716bdf1874
commit
0b4634fce1
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user