Skip to content

Commit 142eba8

Browse files
committed
rtio: Clear flags in prep helpers
Tests were failing when the sqe was allocated on the stack for some architectures. Initialization of variables on the stack is not guaranteed to be zeroed like static data. This caused undefined behavior. Secondly if the sqe is recycled and had a flag set, there would unexpected behavior as well. Signed-off-by: Tom Burdick <[email protected]>
1 parent dca33a1 commit 142eba8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/zephyr/rtio/rtio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ static inline void rtio_sqe_prep_nop(struct rtio_sqe *sqe,
318318
void *userdata)
319319
{
320320
sqe->op = RTIO_OP_NOP;
321+
sqe->flags = 0;
321322
sqe->iodev = iodev;
322323
sqe->userdata = userdata;
323324
}
@@ -334,6 +335,7 @@ static inline void rtio_sqe_prep_read(struct rtio_sqe *sqe,
334335
{
335336
sqe->op = RTIO_OP_RX;
336337
sqe->prio = prio;
338+
sqe->flags = 0;
337339
sqe->iodev = iodev;
338340
sqe->buf_len = len;
339341
sqe->buf = buf;
@@ -352,6 +354,7 @@ static inline void rtio_sqe_prep_write(struct rtio_sqe *sqe,
352354
{
353355
sqe->op = RTIO_OP_TX;
354356
sqe->prio = prio;
357+
sqe->flags = 0;
355358
sqe->iodev = iodev;
356359
sqe->buf_len = len;
357360
sqe->buf = buf;

0 commit comments

Comments
 (0)