From bd1c3c12fe9bc37ab3e3bde964a300da3385a82f Mon Sep 17 00:00:00 2001 From: Luis Ubieda Date: Tue, 22 Jul 2025 20:16:21 -0400 Subject: [PATCH] rtio: fix CQE semaphore by not giving it no CQE item was created Otherwise, calls to rtio_cqe_consume_block will bypass the semaphore and held back in a Z_SPIN_DELAY(1) indefinitely. Signed-off-by: Luis Ubieda --- include/zephyr/rtio/rtio.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/rtio/rtio.h b/include/zephyr/rtio/rtio.h index fade8e5eec19f..092f13f002d42 100644 --- a/include/zephyr/rtio/rtio.h +++ b/include/zephyr/rtio/rtio.h @@ -1309,6 +1309,9 @@ static inline void rtio_cqe_submit(struct rtio *r, int result, void *userdata, u cqe->userdata = userdata; cqe->flags = flags; rtio_cqe_produce(r, cqe); +#ifdef CONFIG_RTIO_CONSUME_SEM + k_sem_give(r->consume_sem); +#endif } /* atomic_t isn't guaranteed to wrap correctly as it could be signed, so @@ -1329,9 +1332,6 @@ static inline void rtio_cqe_submit(struct rtio *r, int result, void *userdata, u } } #endif -#ifdef CONFIG_RTIO_CONSUME_SEM - k_sem_give(r->consume_sem); -#endif } #define __RTIO_MEMPOOL_GET_NUM_BLKS(num_bytes, blk_size) (((num_bytes) + (blk_size)-1) / (blk_size))