Re: [PATCH v2 2/7] rtc: alarmtimer: Use maximum alarm time offset

From: Stephen Boyd
Date: Wed Sep 06 2023 - 17:07:03 EST


Quoting Guenter Roeck (2023-08-30 21:23:54)
> On 8/30/23 14:16, Stephen Boyd wrote:
> >
> > We fail alarmtimer creation in the case that CONFIG_RTC_CLASS=n or when
> > there isn't an rtc. See alarmtimer_get_rtcdev() and how it is called. I
> > doubt it ever really happens in practice, but it looks possible to
> > simulate by unbinding the rtc device driver.
>
> Thanks for the clarification. That really makes me wonder what happens
> if an rtc device is unregistered. The .remove_dev callback of
> alarmtimer_rtc_interface is not populated, and rtc_dev is never cleared.
> That means unbinding an rtc device driver should result in a crash.
> Am I missing something ?
>

Yeah it looks like a potential problem, but most likely nobody actually
removes the rtc device from the system. It would be good to handle this
case in a followup patch anyway though.