Commit 8925e31a authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

rtc: rtc-max8998: 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 4ebabb78
...@@ -256,7 +256,8 @@ static int max8998_rtc_probe(struct platform_device *pdev) ...@@ -256,7 +256,8 @@ static int max8998_rtc_probe(struct platform_device *pdev)
struct max8998_rtc_info *info; struct max8998_rtc_info *info;
int ret; int ret;
info = kzalloc(sizeof(struct max8998_rtc_info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(struct max8998_rtc_info),
GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
...@@ -267,7 +268,7 @@ static int max8998_rtc_probe(struct platform_device *pdev) ...@@ -267,7 +268,7 @@ static int max8998_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
info->rtc_dev = rtc_device_register("max8998-rtc", &pdev->dev, info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8998-rtc",
&max8998_rtc_ops, THIS_MODULE); &max8998_rtc_ops, THIS_MODULE);
if (IS_ERR(info->rtc_dev)) { if (IS_ERR(info->rtc_dev)) {
...@@ -276,8 +277,8 @@ static int max8998_rtc_probe(struct platform_device *pdev) ...@@ -276,8 +277,8 @@ static int max8998_rtc_probe(struct platform_device *pdev)
goto out_rtc; goto out_rtc;
} }
ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
"rtc-alarm0", info); max8998_rtc_alarm_irq, 0, "rtc-alarm0", info);
if (ret < 0) if (ret < 0)
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
...@@ -294,20 +295,11 @@ static int max8998_rtc_probe(struct platform_device *pdev) ...@@ -294,20 +295,11 @@ static int max8998_rtc_probe(struct platform_device *pdev)
out_rtc: out_rtc:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(info);
return ret; return ret;
} }
static int max8998_rtc_remove(struct platform_device *pdev) static int max8998_rtc_remove(struct platform_device *pdev)
{ {
struct max8998_rtc_info *info = platform_get_drvdata(pdev);
if (info) {
free_irq(info->irq, info);
rtc_device_unregister(info->rtc_dev);
kfree(info);
}
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