Laurence de Bruxelles 34127b3632 rtc: pxa: fix null pointer dereference
With the latest stable kernel versions the rtc on the PXA based
Zaurus does not work, when booting I see the following kernel messages:

pxa-rtc pxa-rtc: failed to find rtc clock source
pxa-rtc pxa-rtc: Unable to init SA1100 RTC sub-device
pxa-rtc: probe of pxa-rtc failed with error -2
hctosys: unable to open rtc device (rtc0)

I think this is because commit f2997775b111 ("rtc: sa1100: fix possible
race condition") moved the allocation of the rtc_device struct out of
sa1100_rtc_init and into sa1100_rtc_probe. This means that pxa_rtc_probe
also needs to do allocation for the rtc_device struct, otherwise
sa1100_rtc_init will try to dereference a null pointer. This patch adds
that allocation by copying how sa1100_rtc_probe in
drivers/rtc/rtc-sa1100.c does it; after the IRQs are set up a managed
rtc_device is allocated.

I've tested this patch with `qemu-system-arm -machine akita` and with a
real Zaurus SL-C1000 applied to 4.19, 5.4, and 5.10.

Signed-off-by: Laurence de Bruxelles <lfdebrux@gmail.com>
Fixes: f2997775b111 ("rtc: sa1100: fix possible race condition")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220101154149.12026-1-lfdebrux@gmail.com
2022-01-05 01:05:17 +01:00
..
2021-08-10 23:21:46 +02:00
2021-12-02 23:23:38 +01:00
2021-09-25 23:22:28 +02:00
2021-09-25 23:22:28 +02:00
2019-11-08 16:14:09 +01:00
2019-07-17 10:03:50 -07:00
2021-04-29 23:03:26 +02:00
2021-05-25 00:41:25 +02:00
2021-10-01 23:28:28 +02:00
2021-06-01 16:44:09 +01:00
2021-01-16 23:19:26 +01:00
2021-01-16 23:19:26 +01:00
2021-09-25 23:22:28 +02:00
2021-10-18 17:38:06 +02:00
2021-02-22 14:27:07 -08:00
2021-10-18 17:20:50 +02:00
2021-10-23 23:57:23 +02:00
2021-09-25 23:26:37 +02:00
2020-12-03 23:43:23 +01:00