summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 06:47:16 +0200
committerBryan Wu <bryan.wu@canonical.com>2012-07-24 01:52:37 +0200
commit60a0aadbf8f0858dcc8307afb3ec3c79ecad7c0a (patch)
tree7a34f69890883b7a9bf085c6617aff7165c394f8
parentleds: convert Big Networks LED driver to devm_kzalloc() (diff)
downloadlinux-60a0aadbf8f0858dcc8307afb3ec3c79ecad7c0a.tar.xz
linux-60a0aadbf8f0858dcc8307afb3ec3c79ecad7c0a.zip
leds: convert HTC ASIC3 LED driver to devm_kzalloc() and cleanup error exit path
Cc: Paul Parsons <lost.distance@yahoo.com> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
-rw-r--r--drivers/leds/leds-asic3.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c
index 525a92492837..5de74ff90dcf 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);
}