Commit 4ce903cc authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds
Browse files

rtc: rtc-max8997: use devm_rtc_device_register()



devm_rtc_device_register() is device managed and makes 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 ac4e7d49
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ static int max8997_rtc_probe(struct platform_device *pdev)

	device_init_wakeup(&pdev->dev, 1);

	info->rtc_dev = rtc_device_register("max8997-rtc", &pdev->dev,
	info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc",
					&max8997_rtc_ops, THIS_MODULE);

	if (IS_ERR(info->rtc_dev)) {
@@ -507,17 +507,11 @@ static int max8997_rtc_probe(struct platform_device *pdev)
	return ret;

err_out:
	rtc_device_unregister(info->rtc_dev);
	return ret;
}

static int max8997_rtc_remove(struct platform_device *pdev)
{
	struct max8997_rtc_info *info = platform_get_drvdata(pdev);

	if (info)
		rtc_device_unregister(info->rtc_dev);

	return 0;
}