• John Stultz's avatar
    RTC: Fix early irqs caused by calling rtc_set_alarm too early · f6d5b331
    John Stultz authored
    When we register an rtc device at boot, we read the alarm value
    in hardware and set the rtc device's aie_timer to that value.
    
    The initial method to do this was to simply call rtc_set_alarm()
    with the value read from hardware. However, this may cause problems
    as rtc_set_alarm may enable interupts, and the RTC alarm might fire,
    which can cause invalid pointer dereferencing since the RTC registration
    is not complete.
    
    This patch solves the issue by initializing the rtc_device.aie_timer
    y hand via rtc_initialize_alarm(). This avoids any calls to the RTC
    hardware which might enable interrupts too early.
    
    CC: Thomas Gleixner <tglx@linutronix.de>
    CC: Alessandro Zummo <a.zummo@towertech.it>
    Reported-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Tested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    f6d5b331
class.c 5.87 KB