Skip to content

Commit 9adaf59

Browse files
Mahavir JainAnas Nashif
authored andcommitted
work_q: delayed work cancel returns incorrect status
If delayed work is already submitted or completed, then subsequent cancel should return -EINVAL as return status. Fixes ZEP-1373. Change-Id: I16bbacca7e31a5a5d8e5a89e729d70302ada6223 Signed-off-by: Mahavir Jain <[email protected]> (cherry picked from commit 45f2ef6)
1 parent fcbd5e7 commit 9adaf59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/unified/work_q.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static void work_timeout(struct _timeout *t)
7171

7272
/* submit work to workqueue */
7373
k_work_submit_to_queue(w->work_q, &w->work);
74+
/* detach from workqueue, for cancel to return appropriate status */
75+
w->work_q = NULL;
7476
}
7577

7678
void k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)

0 commit comments

Comments
 (0)