aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-atmel-pwm.c
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 13:01:37 +0800
committerBryan Wu <bryan.wu@canonical.com>2012-07-24 07:52:37 +0800
commit4aad381f0d1de9cca7509d77f1d504f2785870e8 (patch)
tree8a8f7c5e8c78de0ab7bdc9dd2f33b157ab0efa99 /drivers/leds/leds-atmel-pwm.c
parentleds: convert HTC ASIC3 LED driver to devm_kzalloc() and cleanup error exit path (diff)
downloadlinux-dev-4aad381f0d1de9cca7509d77f1d504f2785870e8.tar.xz
linux-dev-4aad381f0d1de9cca7509d77f1d504f2785870e8.zip
leds: convert Atmel PWM LED driver to devm_kzalloc()
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to '')
-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)
if (!pdata || pdata->num_leds < 1)
return -ENODEV;
- leds = kcalloc(pdata->num_leds, sizeof(*leds), GFP_KERNEL);
+ leds = devm_kzalloc(&pdev->dev, pdata->num_leds * sizeof(*leds),
+ GFP_KERNEL);
if (!leds)
return -ENOMEM;
@@ -108,7 +109,6 @@ err:
pwm_channel_free(&leds[i].pwmc);
}
}
- kfree(leds);
return status;
}
@@ -129,7 +129,6 @@ static int __exit pwmled_remove(struct platform_device *pdev)
pwm_channel_free(&led->pwmc);
}
- kfree(leds);
platform_set_drvdata(pdev, NULL);
return 0;
}