Commit 8095c385 authored by Bryan Wu's avatar Bryan Wu

leds: convert Big Networks LED driver to devm_kzalloc()

Cc: Simon Guinot <sguinot@lacie.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent 198b8611
...@@ -362,14 +362,14 @@ static int __devinit netxbig_led_probe(struct platform_device *pdev) ...@@ -362,14 +362,14 @@ static int __devinit netxbig_led_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -EINVAL; return -EINVAL;
leds_data = kzalloc(sizeof(struct netxbig_led_data) * pdata->num_leds, leds_data = devm_kzalloc(&pdev->dev,
GFP_KERNEL); sizeof(struct netxbig_led_data) * pdata->num_leds, GFP_KERNEL);
if (!leds_data) if (!leds_data)
return -ENOMEM; return -ENOMEM;
ret = gpio_ext_init(pdata->gpio_ext); ret = gpio_ext_init(pdata->gpio_ext);
if (ret < 0) if (ret < 0)
goto err_free_data; return ret;
for (i = 0; i < pdata->num_leds; i++) { for (i = 0; i < pdata->num_leds; i++) {
ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]); ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]);
...@@ -386,9 +386,6 @@ static int __devinit netxbig_led_probe(struct platform_device *pdev) ...@@ -386,9 +386,6 @@ static int __devinit netxbig_led_probe(struct platform_device *pdev)
delete_netxbig_led(&leds_data[i]); delete_netxbig_led(&leds_data[i]);
gpio_ext_free(pdata->gpio_ext); gpio_ext_free(pdata->gpio_ext);
err_free_data:
kfree(leds_data);
return ret; return ret;
} }
...@@ -404,7 +401,6 @@ static int __devexit netxbig_led_remove(struct platform_device *pdev) ...@@ -404,7 +401,6 @@ static int __devexit netxbig_led_remove(struct platform_device *pdev)
delete_netxbig_led(&leds_data[i]); delete_netxbig_led(&leds_data[i]);
gpio_ext_free(pdata->gpio_ext); gpio_ext_free(pdata->gpio_ext);
kfree(leds_data);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment