Skip to content

Commit

Permalink
rtc: pxa: fix possible race condition
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexandre Belloni committed Aug 24, 2017
1 parent be8e274 commit 56c0c52
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/rtc/rtc-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,16 @@ 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) {
dev_err(dev, "Unable to map pxa RTC I/O memory\n");
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;
Expand Down

0 comments on commit 56c0c52

Please sign in to comment.