rtio: workq: Initialize Work item before using it

As the items come from the memory slab, their initialization state
can't be guaranteed. This is causing some devices triggering an assert
in p4wq where the item's thread is not null (not zero).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
This commit is contained in:
Luis Ubieda 2024-07-12 15:15:35 -04:00 committed by Anas Nashif
parent 792ae68165
commit 7d9ff8bcb4

View file

@ -42,6 +42,10 @@ struct rtio_work_req *rtio_work_req_alloc(void)
return NULL;
}
/** Initialize work item before using it as it comes
* from a Memory slab (no-init region).
*/
req->work.thread = NULL;
(void)k_sem_init(&req->work.done_sem, 1, 1);
return req;