aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-04-29 19:20:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 21:28:39 -0400
commit431c6c1df36d1511d48ccbd38b9561a486142d42 (patch)
tree2079bc2036a743153920b02884e3736bb7d09224 /drivers/rtc
parent87a81420873d031dc387c6d1c8cefa067b539fa2 (diff)
rtc: rtc-v3020: 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-v3020.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index bca5d677bc85..6e0cba8f47d5 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -309,7 +309,7 @@ static int rtc_probe(struct platform_device *pdev)
309 int i; 309 int i;
310 int temp; 310 int temp;
311 311
312 chip = kzalloc(sizeof *chip, GFP_KERNEL); 312 chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
313 if (!chip) 313 if (!chip)
314 return -ENOMEM; 314 return -ENOMEM;
315 315
@@ -353,8 +353,8 @@ static int rtc_probe(struct platform_device *pdev)
353 353
354 platform_set_drvdata(pdev, chip); 354 platform_set_drvdata(pdev, chip);
355 355
356 chip->rtc = rtc_device_register("v3020", 356 chip->rtc = devm_rtc_device_register(&pdev->dev, "v3020",
357 &pdev->dev, &v3020_rtc_ops, THIS_MODULE); 357 &v3020_rtc_ops, THIS_MODULE);
358 if (IS_ERR(chip->rtc)) { 358 if (IS_ERR(chip->rtc)) {
359 retval = PTR_ERR(chip->rtc); 359 retval = PTR_ERR(chip->rtc);
360 goto err_io; 360 goto err_io;
@@ -365,21 +365,14 @@ static int rtc_probe(struct platform_device *pdev)
365err_io: 365err_io:
366 chip->ops->unmap_io(chip); 366 chip->ops->unmap_io(chip);
367err_chip: 367err_chip:
368 kfree(chip);
369
370 return retval; 368 return retval;
371} 369}
372 370
373static int rtc_remove(struct platform_device *dev) 371static int rtc_remove(struct platform_device *dev)
374{ 372{
375 struct v3020 *chip = platform_get_drvdata(dev); 373 struct v3020 *chip = platform_get_drvdata(dev);
376 struct rtc_device *rtc = chip->rtc;
377
378 if (rtc)
379 rtc_device_unregister(rtc);
380 374
381 chip->ops->unmap_io(chip); 375 chip->ops->unmap_io(chip);
382 kfree(chip);
383 376
384 return 0; 377 return 0;
385} 378}