diff options
author | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> | 2008-03-09 16:42:27 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2008-03-31 18:31:13 -0400 |
commit | d95cbe6158a679d50e03787bb1dc21ff73dac372 (patch) | |
tree | 6a4e28ed398da5405e446c5b74e46bdc1f90746f /drivers/leds/leds-gpio.c | |
parent | a9edadbf790d72adf6ebed476cb5caf7743e7e4a (diff) |
leds: Fix potential leds-gpio oops
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>
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r-- | drivers/leds/leds-gpio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 6c0a9c4761ee..d13b622419df 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
@@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev) | |||
79 | cur_led = &pdata->leds[i]; | 79 | cur_led = &pdata->leds[i]; |
80 | led_dat = &leds_data[i]; | 80 | led_dat = &leds_data[i]; |
81 | 81 | ||
82 | ret = gpio_request(cur_led->gpio, cur_led->name); | ||
83 | if (ret < 0) | ||
84 | goto err; | ||
85 | |||
82 | led_dat->cdev.name = cur_led->name; | 86 | led_dat->cdev.name = cur_led->name; |
83 | led_dat->cdev.default_trigger = cur_led->default_trigger; | 87 | led_dat->cdev.default_trigger = cur_led->default_trigger; |
84 | led_dat->gpio = cur_led->gpio; | 88 | led_dat->gpio = cur_led->gpio; |
@@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev) | |||
87 | led_dat->cdev.brightness_set = gpio_led_set; | 91 | led_dat->cdev.brightness_set = gpio_led_set; |
88 | led_dat->cdev.brightness = LED_OFF; | 92 | led_dat->cdev.brightness = LED_OFF; |
89 | 93 | ||
90 | ret = gpio_request(led_dat->gpio, led_dat->cdev.name); | ||
91 | if (ret < 0) | ||
92 | goto err; | ||
93 | |||
94 | gpio_direction_output(led_dat->gpio, led_dat->active_low); | 94 | gpio_direction_output(led_dat->gpio, led_dat->active_low); |
95 | 95 | ||
96 | INIT_WORK(&led_dat->work, gpio_led_work); | 96 | INIT_WORK(&led_dat->work, gpio_led_work); |