Skip to content

Commit

Permalink
rtio: workq: Initialize Work item before using it
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ubieda authored and nashif committed Jul 13, 2024
1 parent 792ae68 commit 7d9ff8b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/rtio/rtio_workq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7d9ff8b

Please sign in to comment.