Skip to content

Commit cea6bc4

Browse files
tpamborcfriedt
authored andcommitted
tests: drivers: uart: Improve compatibility with 64-bit platforms
Use %zu format specifier for size_t type to ensure compatibility with both 32-bit and 64-bit platforms. Signed-off-by: Tim Pambor <[email protected]>
1 parent feb3d54 commit cea6bc4

File tree

1 file changed

+3
-3
lines changed
  • tests/drivers/uart/uart_async_rx/src

1 file changed

+3
-3
lines changed

tests/drivers/uart/uart_async_rx/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ struct test_async_rx {
150150
atomic_t total_pending_req;
151151
bool in_chunks;
152152
uint8_t exp_consume;
153-
uint32_t byte_cnt;
153+
size_t byte_cnt;
154154
uint8_t curr_len;
155155
uint8_t *curr_buf;
156156
uint8_t *next_buf;
@@ -215,7 +215,7 @@ static bool consumer(void *user_data, uint32_t cnt, bool last, int prio)
215215

216216
for (int j = 0; j < len; j++) {
217217
zassert_equal(buf[j], test_data->exp_consume,
218-
"%02x (exp:%02x) len:%d, total:%d",
218+
"%02x (exp:%02x) len:%zu, total:%zu",
219219
buf[j], test_data->exp_consume, len, test_data->byte_cnt);
220220
test_data->exp_consume++;
221221
}
@@ -313,7 +313,7 @@ static void stress_test(bool in_chunks)
313313
&test_data, 0, 0, Z_TIMEOUT_TICKS(20)),
314314
ZTRESS_THREAD(consumer, &test_data, 0, preempt, Z_TIMEOUT_TICKS(20)));
315315

316-
TC_PRINT("total bytes: %d\n", test_data.byte_cnt);
316+
TC_PRINT("total bytes: %zu\n", test_data.byte_cnt);
317317
ztress_set_timeout(K_NO_WAIT);
318318
}
319319

0 commit comments

Comments
 (0)