rtc: digicolor: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 30 Apr 2019 09:32:09 +0000 (11:32 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 8 May 2019 20:13:37 +0000 (22:13 +0200)
commit060711f5274dfc2d76a5b2cd65abf6ccbf061e40
tree2ea6a0a993fd6bb7fe1ec2f2141994b652029b40
parent86836d641d33a23c05078e152f834b949bac7565
rtc: digicolor: 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.

Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-digicolor.c