]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: ds1286: Initialize drvdata before registering device
authorJohn Stultz <john.stultz@linaro.org>
Sat, 7 May 2011 00:21:12 +0000 (17:21 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Sat, 7 May 2011 00:42:47 +0000 (17:42 -0700)
commited3195cdea887d18162b26cc88bd0d94e78886cc
tree2923528b76a0f27e6244ff58daf4c80cb3e32f20
parent5310df210f55f0e8a4bf1912d12471d82a077532
rtc: ds1286: Initialize drvdata before registering device

Commit 7a6b0e5dea5 ("RTC: Initialize kernel state from RTC") uncovered
an issue in a number of RTC drivers, where the drivers call
rtc_device_register before initializing the device or platform drvdata.

This frequently results in null pointer dereferences when the
rtc_device_register immediately makes use of the rtc device, calling
rtc_read_alarm.

The solution is to ensure the drvdata is initialized prior to registering
the rtc device.

CC: Wolfram Sang <w.sang@pengutronix.de>
CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: rtc-linux@googlegroups.com
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/rtc/rtc-ds1286.c