rtc: st-lpc: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 20 May 2018 12:33:36 +0000 (14:33 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 23 May 2018 07:25:27 +0000 (09:25 +0200)
commitd482510fee9957ffaca3a0357c655628f3e3870b
tree74185f8d03ec53dfba3343c132a7f8d116dd817a
parentb72252b6580c9c7ad74644642378e2a9a86b2283
rtc: st-lpc: 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.

Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-st-lpc.c