Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[cascardo/linux.git] / drivers / rtc / rtc-da9052.c
index 1ba4371..a20bcf0 100644 (file)
@@ -302,6 +302,13 @@ static int da9052_rtc_probe(struct platform_device *pdev)
        if (ret != 0)
                rtc_err(rtc, "Failed to disable TICKS: %d\n", ret);
 
+       device_init_wakeup(&pdev->dev, true);
+       rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+                                      &da9052_rtc_ops, THIS_MODULE);
+
+       if (IS_ERR(rtc->rtc))
+               return PTR_ERR(rtc->rtc);
+
        ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM",
                                da9052_rtc_irq, rtc);
        if (ret != 0) {
@@ -309,11 +316,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
                return ret;
        }
 
-       device_init_wakeup(&pdev->dev, true);
-
-       rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                                      &da9052_rtc_ops, THIS_MODULE);
-       return PTR_ERR_OR_ZERO(rtc->rtc);
+       return 0;
 }
 
 static struct platform_driver da9052_rtc_driver = {