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

Merge pull request #17409 from kaspar030/ztimer_no_timer_fix

sys/ztimer: don't access non-existant timer
This commit is contained in:
Kaspar Schleiser 2021-12-17 23:27:04 +01:00 committed by GitHub
commit 43988120f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,20 +373,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);
}
}
}