aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 6a2109638fbe..77e2e4057929 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -126,7 +126,7 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
126 if (!template->retain_state_suspended) 126 if (!template->retain_state_suspended)
127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
128 128
129 ret = gpio_request_one(template->gpio, 129 ret = devm_gpio_request_one(parent, template->gpio,
130 GPIOF_DIR_OUT | (led_dat->active_low ^ state), 130 GPIOF_DIR_OUT | (led_dat->active_low ^ state),
131 template->name); 131 template->name);
132 if (ret < 0) 132 if (ret < 0)
@@ -136,12 +136,9 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
136 136
137 ret = led_classdev_register(parent, &led_dat->cdev); 137 ret = led_classdev_register(parent, &led_dat->cdev);
138 if (ret < 0) 138 if (ret < 0)
139 goto err; 139 return ret;
140 140
141 return 0; 141 return 0;
142err:
143 gpio_free(led_dat->gpio);
144 return ret;
145} 142}
146 143
147static void delete_gpio_led(struct gpio_led_data *led) 144static void delete_gpio_led(struct gpio_led_data *led)
@@ -150,7 +147,6 @@ static void delete_gpio_led(struct gpio_led_data *led)
150 return; 147 return;
151 led_classdev_unregister(&led->cdev); 148 led_classdev_unregister(&led->cdev);
152 cancel_work_sync(&led->work); 149 cancel_work_sync(&led->work);
153 gpio_free(led->gpio);
154} 150}
155 151
156struct gpio_leds_priv { 152struct gpio_leds_priv {