aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 01:01:37 -0400
committerBryan Wu <bryan.wu@canonical.com>2012-07-23 19:52:37 -0400
commit4aad381f0d1de9cca7509d77f1d504f2785870e8 (patch)
tree8a8f7c5e8c78de0ab7bdc9dd2f33b157ab0efa99 /drivers/leds
parent60a0aadbf8f0858dcc8307afb3ec3c79ecad7c0a (diff)
leds: convert Atmel PWM LED driver to devm_kzalloc()
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-atmel-pwm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index 64ad702a2ecc..45430632faab 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -46,7 +46,8 @@ static int __devinit pwmled_probe(struct platform_device *pdev)
46 if (!pdata || pdata->num_leds < 1) 46 if (!pdata || pdata->num_leds < 1)
47 return -ENODEV; 47 return -ENODEV;
48 48
49 leds = kcalloc(pdata->num_leds, sizeof(*leds), GFP_KERNEL); 49 leds = devm_kzalloc(&pdev->dev, pdata->num_leds * sizeof(*leds),
50 GFP_KERNEL);
50 if (!leds) 51 if (!leds)
51 return -ENOMEM; 52 return -ENOMEM;
52 53
@@ -108,7 +109,6 @@ err:
108 pwm_channel_free(&leds[i].pwmc); 109 pwm_channel_free(&leds[i].pwmc);
109 } 110 }
110 } 111 }
111 kfree(leds);
112 112
113 return status; 113 return status;
114} 114}
@@ -129,7 +129,6 @@ static int __exit pwmled_remove(struct platform_device *pdev)
129 pwm_channel_free(&led->pwmc); 129 pwm_channel_free(&led->pwmc);
130 } 130 }
131 131
132 kfree(leds);
133 platform_set_drvdata(pdev, NULL); 132 platform_set_drvdata(pdev, NULL);
134 return 0; 133 return 0;
135} 134}