From: Bryan Wu Date: Wed, 4 Jul 2012 03:51:51 +0000 (+0800) Subject: leds: convert LT3593 LED driver to devm_kzalloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0a8d9d4a61d8c7d6ea00835c814a678ba488b8aa;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git leds: convert LT3593 LED driver to devm_kzalloc() Cc: Daniel Mack Signed-off-by: Bryan Wu --- diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index e311a96c4469..09a732217f6d 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -149,8 +149,9 @@ static int __devinit lt3593_led_probe(struct platform_device *pdev) if (!pdata) return -EBUSY; - leds_data = kzalloc(sizeof(struct lt3593_led_data) * pdata->num_leds, - GFP_KERNEL); + leds_data = devm_kzalloc(&pdev->dev, + sizeof(struct lt3593_led_data) * pdata->num_leds, + GFP_KERNEL); if (!leds_data) return -ENOMEM; @@ -169,8 +170,6 @@ err: for (i = i - 1; i >= 0; i--) delete_lt3593_led(&leds_data[i]); - kfree(leds_data); - return ret; } @@ -185,8 +184,6 @@ static int __devexit lt3593_led_remove(struct platform_device *pdev) for (i = 0; i < pdata->num_leds; i++) delete_lt3593_led(&leds_data[i]); - kfree(leds_data); - return 0; }