diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-10 18:09:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:49 -0500 |
commit | c957b614bde8539416dcde8d702370ff30b1c662 (patch) | |
tree | 06b97ffc49747d3410616c32de8a39a8cdc6129f /drivers/leds/leds-wm8350.c | |
parent | 1713cb9d6069fac581fcea928f65ca6ca7c9facf (diff) |
leds: convert wm8350 driver to devm_kzalloc()
Saves a small amount of code and systematically eliminates leaks.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds/leds-wm8350.c')
-rw-r--r-- | drivers/leds/leds-wm8350.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c index 390c0f679628..918d4baff1c7 100644 --- a/drivers/leds/leds-wm8350.c +++ b/drivers/leds/leds-wm8350.c | |||
@@ -227,7 +227,7 @@ static int wm8350_led_probe(struct platform_device *pdev) | |||
227 | goto err_isink; | 227 | goto err_isink; |
228 | } | 228 | } |
229 | 229 | ||
230 | led = kzalloc(sizeof(*led), GFP_KERNEL); | 230 | led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); |
231 | if (led == NULL) { | 231 | if (led == NULL) { |
232 | ret = -ENOMEM; | 232 | ret = -ENOMEM; |
233 | goto err_dcdc; | 233 | goto err_dcdc; |
@@ -259,12 +259,10 @@ static int wm8350_led_probe(struct platform_device *pdev) | |||
259 | 259 | ||
260 | ret = led_classdev_register(&pdev->dev, &led->cdev); | 260 | ret = led_classdev_register(&pdev->dev, &led->cdev); |
261 | if (ret < 0) | 261 | if (ret < 0) |
262 | goto err_led; | 262 | goto err_dcdc; |
263 | 263 | ||
264 | return 0; | 264 | return 0; |
265 | 265 | ||
266 | err_led: | ||
267 | kfree(led); | ||
268 | err_dcdc: | 266 | err_dcdc: |
269 | regulator_put(dcdc); | 267 | regulator_put(dcdc); |
270 | err_isink: | 268 | err_isink: |
@@ -281,7 +279,6 @@ static int wm8350_led_remove(struct platform_device *pdev) | |||
281 | wm8350_led_disable(led); | 279 | wm8350_led_disable(led); |
282 | regulator_put(led->dcdc); | 280 | regulator_put(led->dcdc); |
283 | regulator_put(led->isink); | 281 | regulator_put(led->isink); |
284 | kfree(led); | ||
285 | return 0; | 282 | return 0; |
286 | } | 283 | } |
287 | 284 | ||