Commit a379fd24 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

rtc: rtc-mc13xxx: use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8925e31a
...@@ -316,7 +316,7 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) ...@@ -316,7 +316,7 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
struct mc13xxx *mc13xxx; struct mc13xxx *mc13xxx;
int rtcrst_pending; int rtcrst_pending;
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
...@@ -351,8 +351,8 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) ...@@ -351,8 +351,8 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
mc13xxx_unlock(mc13xxx); mc13xxx_unlock(mc13xxx);
priv->rtc = rtc_device_register(pdev->name, priv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
&pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE); &mc13xxx_rtc_ops, THIS_MODULE);
if (IS_ERR(priv->rtc)) { if (IS_ERR(priv->rtc)) {
ret = PTR_ERR(priv->rtc); ret = PTR_ERR(priv->rtc);
...@@ -372,7 +372,6 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev) ...@@ -372,7 +372,6 @@ static int __init mc13xxx_rtc_probe(struct platform_device *pdev)
mc13xxx_unlock(mc13xxx); mc13xxx_unlock(mc13xxx);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(priv);
} }
return ret; return ret;
...@@ -384,8 +383,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) ...@@ -384,8 +383,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev)
mc13xxx_lock(priv->mc13xxx); mc13xxx_lock(priv->mc13xxx);
rtc_device_unregister(priv->rtc);
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv); mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_TODA, priv);
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv); mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_1HZ, priv);
mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv); mc13xxx_irq_free(priv->mc13xxx, MC13XXX_IRQ_RTCRST, priv);
...@@ -394,8 +391,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev) ...@@ -394,8 +391,6 @@ static int __exit mc13xxx_rtc_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(priv);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment