Skip to content

Commit 108b38b

Browse files
teburdfabiobaltieri
authored andcommitted
rtio: Fix signed compare warning
atomic_t is a machine word signed integer but cq_count is meant to be an unsigned positive only count of total completions. Cast when needed to ensure the correct math and comparisons are being done. Signed-off-by: Tom Burdick <[email protected]>
1 parent 0ab14d9 commit 108b38b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/zephyr/rtio/rtio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,7 @@ static inline int z_impl_rtio_submit(struct rtio *r, uint32_t wait_count)
14091409
r->submit_count = wait_count;
14101410
}
14111411
#else
1412-
uintptr_t cq_count = atomic_get(&r->cq_count) + wait_count;
1412+
uintptr_t cq_count = (uintptr_t)atomic_get(&r->cq_count) + wait_count;
14131413
#endif
14141414

14151415
/* Submit the queue to the executor which consumes submissions
@@ -1429,7 +1429,7 @@ static inline int z_impl_rtio_submit(struct rtio *r, uint32_t wait_count)
14291429
"semaphore was reset or timed out while waiting on completions!");
14301430
}
14311431
#else
1432-
while (atomic_get(&r->cq_count) < cq_count) {
1432+
while ((uintptr_t)atomic_get(&r->cq_count) < cq_count) {
14331433
Z_SPIN_DELAY(10);
14341434
k_yield();
14351435
}

0 commit comments

Comments
 (0)