Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Alexandre Belloni <alexandre.belloni@free-electrons.com>

+7 -2
+7 -2
drivers/rtc/rtc-omap.c
··· 797 797 798 798 device_init_wakeup(&pdev->dev, true); 799 799 800 - rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, 801 - &omap_rtc_ops, THIS_MODULE); 800 + rtc->rtc = devm_rtc_allocate_device(&pdev->dev); 802 801 if (IS_ERR(rtc->rtc)) { 803 802 ret = PTR_ERR(rtc->rtc); 804 803 goto err; 805 804 } 805 + 806 + rtc->rtc->ops = &omap_rtc_ops; 806 807 807 808 /* handle periodic and alarm irqs */ 808 809 ret = devm_request_irq(&pdev->dev, rtc->irq_timer, rtc_irq, 0, ··· 834 833 ret = PTR_ERR(rtc->pctldev); 835 834 goto err; 836 835 } 836 + 837 + ret = rtc_register_device(rtc->rtc); 838 + if (ret) 839 + goto err; 837 840 838 841 return 0; 839 842