sched: finalize_cancel_locked can early return

The code `SYS_SLIST_FOR_EACH_CONTAINER_SAFE` just for remove work
from `pending_cancels`.
After removing work successfully, the function can return early.
It is unnecessary to iterate continuously.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
This commit is contained in:
TaiJu Wu 2024-02-17 01:06:16 +08:00 committed by Chris Friedt
parent 03fce7dd3c
commit 39f710136e

View file

@ -141,9 +141,9 @@ static void finalize_cancel_locked(struct k_work *work)
if (wc->work == work) {
sys_slist_remove(&pending_cancels, prev, &wc->node);
k_sem_give(&wc->sem);
} else {
prev = &wc->node;
break;
}
prev = &wc->node;
}
}