]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rtc: pxa: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Mon, 21 Aug 2017 15:57:42 +0000 (17:57 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 24 Aug 2017 09:03:34 +0000 (11:03 +0200)
pxa_rtc_open() registers the interrupt handler which will access the RTC
registers. However, pxa_rtc_open() is called before the register range is
ioremapped. Instead, call it after devm_ioremap().

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-pxa.c

index fe4985b546088731f9dac7b3338111a35d0db07f..47304f5664d83fc10afec302aa47aac47523f462 100644 (file)
@@ -348,7 +348,7 @@ static int __init pxa_rtc_probe(struct platform_device *pdev)
                dev_err(dev, "No alarm IRQ resource defined\n");
                return -ENXIO;
        }
-       pxa_rtc_open(dev);
+
        pxa_rtc->base = devm_ioremap(dev, pxa_rtc->ress->start,
                                resource_size(pxa_rtc->ress));
        if (!pxa_rtc->base) {
@@ -356,6 +356,8 @@ static int __init pxa_rtc_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
+       pxa_rtc_open(dev);
+
        sa1100_rtc->rcnr = pxa_rtc->base + 0x0;
        sa1100_rtc->rtsr = pxa_rtc->base + 0x8;
        sa1100_rtc->rtar = pxa_rtc->base + 0x4;