提交 57072758 编写于 作者: A Alexandre Belloni

rtc: omap: switch to rtc_register_device

This removes a possible race condition and crash and allows for further
improvement of the driver.
Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
上级 26e480f7
......@@ -797,13 +797,14 @@ static int omap_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, true);
rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
&omap_rtc_ops, THIS_MODULE);
rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc)) {
ret = PTR_ERR(rtc->rtc);
goto err;
}
rtc->rtc->ops = &omap_rtc_ops;
/* handle periodic and alarm irqs */
ret = devm_request_irq(&pdev->dev, rtc->irq_timer, rtc_irq, 0,
dev_name(&rtc->rtc->dev), rtc);
......@@ -834,6 +835,10 @@ static int omap_rtc_probe(struct platform_device *pdev)
goto err;
}
ret = rtc_register_device(rtc->rtc);
if (ret)
goto err;
return 0;
err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册