aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-03-23 18:02:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-23 19:58:33 -0400
commit050ea48bbfc80b6aa81f8df0d9f25e6e47d96e98 (patch)
tree8de9685ba5e2115ed6e14228d017c93351be2c2c
parentce969228fdb54a7e3d7cc1ed27367fd4b9525d74 (diff)
drivers/video/backlight/adp5520_bl.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/backlight/adp5520_bl.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index 2e630bf1164c..4911ea7989c8 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -289,7 +289,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
289 struct adp5520_bl *data; 289 struct adp5520_bl *data;
290 int ret = 0; 290 int ret = 0;
291 291
292 data = kzalloc(sizeof(*data), GFP_KERNEL); 292 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
293 if (data == NULL) 293 if (data == NULL)
294 return -ENOMEM; 294 return -ENOMEM;
295 295
@@ -298,7 +298,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
298 298
299 if (data->pdata == NULL) { 299 if (data->pdata == NULL) {
300 dev_err(&pdev->dev, "missing platform data\n"); 300 dev_err(&pdev->dev, "missing platform data\n");
301 kfree(data);
302 return -ENODEV; 301 return -ENODEV;
303 } 302 }
304 303
@@ -314,7 +313,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
314 &adp5520_bl_ops, &props); 313 &adp5520_bl_ops, &props);
315 if (IS_ERR(bl)) { 314 if (IS_ERR(bl)) {
316 dev_err(&pdev->dev, "failed to register backlight\n"); 315 dev_err(&pdev->dev, "failed to register backlight\n");
317 kfree(data);
318 return PTR_ERR(bl); 316 return PTR_ERR(bl);
319 } 317 }
320 318
@@ -326,7 +324,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
326 if (ret) { 324 if (ret) {
327 dev_err(&pdev->dev, "failed to register sysfs\n"); 325 dev_err(&pdev->dev, "failed to register sysfs\n");
328 backlight_device_unregister(bl); 326 backlight_device_unregister(bl);
329 kfree(data);
330 } 327 }
331 328
332 platform_set_drvdata(pdev, bl); 329 platform_set_drvdata(pdev, bl);
@@ -348,7 +345,6 @@ static int __devexit adp5520_bl_remove(struct platform_device *pdev)
348 &adp5520_bl_attr_group); 345 &adp5520_bl_attr_group);
349 346
350 backlight_device_unregister(bl); 347 backlight_device_unregister(bl);
351 kfree(data);
352 348
353 return 0; 349 return 0;
354} 350}