aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/leds/leds-wm8350.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c
index 390c0f679628..918d4baff1c7 100644
--- a/drivers/leds/leds-wm8350.c
+++ b/drivers/leds/leds-wm8350.c
@@ -227,7 +227,7 @@ static int wm8350_led_probe(struct platform_device *pdev)
227 goto err_isink; 227 goto err_isink;
228 } 228 }
229 229
230 led = kzalloc(sizeof(*led), GFP_KERNEL); 230 led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
231 if (led == NULL) { 231 if (led == NULL) {
232 ret = -ENOMEM; 232 ret = -ENOMEM;
233 goto err_dcdc; 233 goto err_dcdc;
@@ -259,12 +259,10 @@ static int wm8350_led_probe(struct platform_device *pdev)
259 259
260 ret = led_classdev_register(&pdev->dev, &led->cdev); 260 ret = led_classdev_register(&pdev->dev, &led->cdev);
261 if (ret < 0) 261 if (ret < 0)
262 goto err_led; 262 goto err_dcdc;
263 263
264 return 0; 264 return 0;
265 265
266 err_led:
267 kfree(led);
268 err_dcdc: 266 err_dcdc:
269 regulator_put(dcdc); 267 regulator_put(dcdc);
270 err_isink: 268 err_isink:
@@ -281,7 +279,6 @@ static int wm8350_led_remove(struct platform_device *pdev)
281 wm8350_led_disable(led); 279 wm8350_led_disable(led);
282 regulator_put(led->dcdc); 280 regulator_put(led->dcdc);
283 regulator_put(led->isink); 281 regulator_put(led->isink);
284 kfree(led);
285 return 0; 282 return 0;
286} 283}
287 284