rtc: stm32: manage the get_irq probe defer case
authorFabien Dessenne <fabien.dessenne@st.com>
Wed, 24 Apr 2019 12:26:48 +0000 (14:26 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 29 Apr 2019 13:53:42 +0000 (15:53 +0200)
Manage the -EPROBE_DEFER error case for the wake IRQ.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Acked-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-stm32.c

index c5908cfea2340ff3233322e1786aac63b74ec8b8..8e6c9b3bcc29a4d2fec1c52cd2118f4a35cee00e 100644 (file)
@@ -788,11 +788,14 @@ static int stm32_rtc_probe(struct platform_device *pdev)
        ret = device_init_wakeup(&pdev->dev, true);
        if (rtc->data->has_wakeirq) {
                rtc->wakeirq_alarm = platform_get_irq(pdev, 1);
-               if (rtc->wakeirq_alarm <= 0)
-                       ret = rtc->wakeirq_alarm;
-               else
+               if (rtc->wakeirq_alarm > 0) {
                        ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
                                                            rtc->wakeirq_alarm);
+               } else {
+                       ret = rtc->wakeirq_alarm;
+                       if (rtc->wakeirq_alarm == -EPROBE_DEFER)
+                               goto err;
+               }
        }
        if (ret)
                dev_warn(&pdev->dev, "alarm can't wake up the system: %d", ret);