rtc: 88pm860x: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 11 Mar 2020 22:39:51 +0000 (23:39 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 16 Mar 2020 10:55:55 +0000 (11:55 +0100)
commit9cf4789e6e4673d0b2c96fa6bb0c35e81b43111a
tree5e7b64c19aafc2d6167cfa82d4f7f8e8c191171d
parent7863bd076b990f57076f2123337b67b5d5ccd190
rtc: 88pm860x: fix possible race condition

The RTC IRQ is requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in the IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Also remove the unnecessary error message as the core already prints the
info.

Link: https://lore.kernel.org/r/20200311223956.51352-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-88pm860x.c