diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 19:20:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:37 -0400 |
commit | a379fd2458d78d3286c8103aa479839b073c89fe (patch) | |
tree | bafafb0aee3e0475aac8e239cea178b5f163ac0b /drivers/rtc | |
parent | 8925e31a9c8b12c74e4cfdc61447ed40caccb11b (diff) |
rtc: rtc-mc13xxx: 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-mc13xxx.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index 5391b154b43c..7a8ed27a5f2e 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c | |||
@@ -316,7 +316,7 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) | |||
316 | struct mc13xxx *mc13xxx; | 316 | struct mc13xxx *mc13xxx; |
317 | int rtcrst_pending; | 317 | int rtcrst_pending; |
318 | 318 | ||
319 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 319 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
320 | if (!priv) | 320 | if (!priv) |
321 | return -ENOMEM; | 321 | return -ENOMEM; |
322 | 322 | ||
@@ -351,8 +351,8 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) | |||
351 | 351 | ||
352 | mc13xxx_unlock(mc13xxx); | 352 | mc13xxx_unlock(mc13xxx); |
353 | 353 | ||
354 | priv->rtc = rtc_device_register(pdev->name, | 354 | priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
355 | &pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE); | 355 | &mc13xxx_rtc_ops, THIS_MODULE); |
356 | if (IS_ERR(priv->rtc)) { | 356 | if (IS_ERR(priv->rtc)) { |
357 | ret = PTR_ERR(priv->rtc); | 357 | ret = PTR_ERR(priv->rtc); |
358 | 358 | ||
@@ -372,7 +372,6 @@ err_reset_irq_request: | |||
372 | mc13xxx_unlock(mc13xxx); | 372 | mc13xxx_unlock(mc13xxx); |
373 | 373 | ||
374 | platform_set_drvdata(pdev, NULL); | 374 | platform_set_drvdata(pdev, NULL); |
375 | kfree(priv); | ||
376 | } | 375 | } |
377 | 376 | ||
378 | return ret; | 377 | return ret; |
@@ -384,8 +383,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) | |||
384 | 383 | ||
385 | mc13xxx_lock(priv->mc13xxx); | 384 | mc13xxx_lock(priv->mc13xxx); |
386 | 385 | ||
387 | rtc_device_unregister(priv->rtc); | ||
388 | |||
389 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv); | 386 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv); |
390 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv); | 387 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv); |
391 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv); | 388 | mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv); |
@@ -394,8 +391,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) | |||
394 | 391 | ||
395 | platform_set_drvdata(pdev, NULL); | 392 | platform_set_drvdata(pdev, NULL); |
396 | 393 | ||
397 | kfree(priv); | ||
398 | |||
399 | return 0; | 394 | return 0; |
400 | } | 395 | } |
401 | 396 | ||