Commit d95cbe61 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Richard Purdie

leds: Fix potential leds-gpio oops

Call gpio_cansleep only after gpio_request succeeded avoiding an
oops.
Signed-off-by: default avatarUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarRichard Purdie <rpurdie@rpsys.net>
parent a9edadbf
......@@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev)
cur_led = &pdata->leds[i];
led_dat = &leds_data[i];
ret = gpio_request(cur_led->gpio, cur_led->name);
if (ret < 0)
goto err;
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->gpio = cur_led->gpio;
......@@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev)
led_dat->cdev.brightness_set = gpio_led_set;
led_dat->cdev.brightness = LED_OFF;
ret = gpio_request(led_dat->gpio, led_dat->cdev.name);
if (ret < 0)
goto err;
gpio_direction_output(led_dat->gpio, led_dat->active_low);
INIT_WORK(&led_dat->work, gpio_led_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment