lkml.org 
[lkml]   [2012]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/25] leds: convert HTC ASIC3 LED driver to devm_kzalloc() and cleanup error exit path
Date
Cc: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
---
drivers/leds/leds-asic3.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c
index 525a924..5de74ff 100644
--- a/drivers/leds/leds-asic3.c
+++ b/drivers/leds/leds-asic3.c
@@ -99,12 +99,13 @@ static int __devinit asic3_led_probe(struct platform_device *pdev)

ret = mfd_cell_enable(pdev);
if (ret < 0)
- goto ret0;
+ return ret;

- led->cdev = kzalloc(sizeof(struct led_classdev), GFP_KERNEL);
+ led->cdev = devm_kzalloc(&pdev->dev, sizeof(struct led_classdev),
+ GFP_KERNEL);
if (!led->cdev) {
ret = -ENOMEM;
- goto ret1;
+ goto out;
}

led->cdev->name = led->name;
@@ -115,15 +116,12 @@ static int __devinit asic3_led_probe(struct platform_device *pdev)

ret = led_classdev_register(&pdev->dev, led->cdev);
if (ret < 0)
- goto ret2;
+ goto out;

return 0;

-ret2:
- kfree(led->cdev);
-ret1:
+out:
(void) mfd_cell_disable(pdev);
-ret0:
return ret;
}

@@ -133,8 +131,6 @@ static int __devexit asic3_led_remove(struct platform_device *pdev)

led_classdev_unregister(led->cdev);

- kfree(led->cdev);
-
return mfd_cell_disable(pdev);
}

--
1.7.10.4


\
 
 \ /
  Last update: 2012-07-04 07:41    [W:0.143 / U:13.788 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site