Skip to content

Commit

Permalink
leds: Fix potential leds-gpio oops
Browse files Browse the repository at this point in the history
Call gpio_cansleep only after gpio_request succeeded avoiding an
oops.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
  • Loading branch information
Uwe Kleine-König authored and Richard Purdie committed Mar 31, 2008
1 parent a9edadb commit d95cbe6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/leds/leds-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit d95cbe6

Please sign in to comment.