1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/ztimer: don't access non-existant timer

This commit is contained in:
Kaspar Schleiser 2021-12-15 15:51:59 +01:00
parent e3f6212708
commit b551bbf747

View File

@ -366,20 +366,23 @@ void ztimer_handler(ztimer_clock_t *clock)
}
#endif
clock->list.offset += clock->list.next->offset;
clock->list.next->offset = 0;
if (clock->list.next) {
clock->list.offset += clock->list.next->offset;
clock->list.next->offset = 0;
ztimer_t *entry = _now_next(clock);
while (entry) {
DEBUG("ztimer_handler(): trigger %p->%p at %" PRIu32 "\n",
(void *)entry, (void *)entry->base.next, clock->ops->now(clock));
entry->callback(entry->arg);
entry = _now_next(clock);
if (!entry) {
/* See if any more alarms expired during callback processing */
/* This reduces the number of implicit calls to clock->ops->now() */
_ztimer_update_head_offset(clock);
ztimer_t *entry = _now_next(clock);
while (entry) {
DEBUG("ztimer_handler(): trigger %p->%p at %" PRIu32 "\n",
(void *)entry, (void *)entry->base.next, clock->ops->now(
clock));
entry->callback(entry->arg);
entry = _now_next(clock);
if (!entry) {
/* See if any more alarms expired during callback processing */
/* This reduces the number of implicit calls to clock->ops->now() */
_ztimer_update_head_offset(clock);
entry = _now_next(clock);
}
}
}