OSDN Git Service

rtc: mxc_v2: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 19 May 2018 08:01:42 +0000 (10:01 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 19 May 2018 08:47:46 +0000 (10:47 +0200)
commit5490a1e018a4b447c1fdb49ec274a620e60a4d42
treeca7326fd9063e781d6ce2fcab27f004201894ca7
parentd7599245007a653fb5ff96d5ae067cb3204ff7fb
rtc: mxc_v2: 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
before requesting the IRQ.

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