aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 00:42:55 -0400
committerBryan Wu <bryan.wu@canonical.com>2012-07-23 19:52:37 -0400
commit8095c385aacf54724ee571d65df987330da9fbd9 (patch)
treeaec415a3278e21b14e92c2f7534ccd4481095b6d /drivers/leds
parent198b8611315f793a8f674c3ca3324028e19634aa (diff)
leds: convert Big Networks LED driver to devm_kzalloc()
Cc: Simon Guinot <sguinot@lacie.com> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-netxbig.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
index 73973fdbd8be..e37618e363cf 100644
--- a/drivers/leds/leds-netxbig.c
+++ b/drivers/leds/leds-netxbig.c
@@ -362,14 +362,14 @@ static int __devinit netxbig_led_probe(struct platform_device *pdev)
362 if (!pdata) 362 if (!pdata)
363 return -EINVAL; 363 return -EINVAL;
364 364
365 leds_data = kzalloc(sizeof(struct netxbig_led_data) * pdata->num_leds, 365 leds_data = devm_kzalloc(&pdev->dev,
366 GFP_KERNEL); 366 sizeof(struct netxbig_led_data) * pdata->num_leds, GFP_KERNEL);
367 if (!leds_data) 367 if (!leds_data)
368 return -ENOMEM; 368 return -ENOMEM;
369 369
370 ret = gpio_ext_init(pdata->gpio_ext); 370 ret = gpio_ext_init(pdata->gpio_ext);
371 if (ret < 0) 371 if (ret < 0)
372 goto err_free_data; 372 return ret;
373 373
374 for (i = 0; i < pdata->num_leds; i++) { 374 for (i = 0; i < pdata->num_leds; i++) {
375 ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]); 375 ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]);
@@ -386,9 +386,6 @@ err_free_leds:
386 delete_netxbig_led(&leds_data[i]); 386 delete_netxbig_led(&leds_data[i]);
387 387
388 gpio_ext_free(pdata->gpio_ext); 388 gpio_ext_free(pdata->gpio_ext);
389err_free_data:
390 kfree(leds_data);
391
392 return ret; 389 return ret;
393} 390}
394 391
@@ -404,7 +401,6 @@ static int __devexit netxbig_led_remove(struct platform_device *pdev)
404 delete_netxbig_led(&leds_data[i]); 401 delete_netxbig_led(&leds_data[i]);
405 402
406 gpio_ext_free(pdata->gpio_ext); 403 gpio_ext_free(pdata->gpio_ext);
407 kfree(leds_data);
408 404
409 return 0; 405 return 0;
410} 406}