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 <mjain@marvell.com>
This commit is contained in:
Mahavir Jain 2016-12-01 21:52:10 +05:30 committed by Anas Nashif
parent 96c4a4b3a3
commit 45f2ef653d

View file

@ -71,6 +71,8 @@ static void work_timeout(struct _timeout *t)
/* submit work to workqueue */
k_work_submit_to_queue(w->work_q, &w->work);
/* detach from workqueue, for cancel to return appropriate status */
w->work_q = NULL;
}
void k_delayed_work_init(struct k_delayed_work *work, k_work_handler_t handler)