rtc: mxc: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 16 Apr 2019 08:30:43 +0000 (10:30 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 29 Apr 2019 13:53:42 +0000 (15:53 +0200)
commitebc2ec4ecf1893b9afaecc59fbd04b2bdf34f7c2
tree128a206c66821335fe30f285d5a97b0cdc6b47a2
parentcf612c5949aca2bd81a1e28688957c8149ea2693
rtc: mxc: fix possible race condition

The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-mxc.c