summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 16:20:40 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:28:37 -0700
commit2a444cf77cb584485aea4f1ee5538a5dee705e99 (patch)
tree196542dec0503f155e557186f3ecd69025b31777 /drivers/rtc
parent1ce95ba7441240fef3becbf0d5be98141c45f0a5 (diff)
rtc: rtc-ds2404: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds2404.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index b04fc4272fb..2ca5a23aba8 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -228,7 +228,7 @@ static int rtc_probe(struct platform_device *pdev)
struct ds2404 *chip;
int retval = -EBUSY;
- chip = kzalloc(sizeof(struct ds2404), GFP_KERNEL);
+ chip = devm_kzalloc(&pdev->dev, sizeof(struct ds2404), GFP_KERNEL);
if (!chip)
return -ENOMEM;
@@ -244,8 +244,8 @@ static int rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, chip);
- chip->rtc = rtc_device_register("ds2404",
- &pdev->dev, &ds2404_rtc_ops, THIS_MODULE);
+ chip->rtc = devm_rtc_device_register(&pdev->dev, "ds2404",
+ &ds2404_rtc_ops, THIS_MODULE);
if (IS_ERR(chip->rtc)) {
retval = PTR_ERR(chip->rtc);
goto err_io;
@@ -257,20 +257,14 @@ static int rtc_probe(struct platform_device *pdev)
err_io:
chip->ops->unmap_io(chip);
err_chip:
- kfree(chip);
return retval;
}
static int rtc_remove(struct platform_device *dev)
{
struct ds2404 *chip = platform_get_drvdata(dev);
- struct rtc_device *rtc = chip->rtc;
-
- if (rtc)
- rtc_device_unregister(rtc);
chip->ops->unmap_io(chip);
- kfree(chip);
return 0;
}