Skip to content

Commit 8595a39

Browse files
Enjia Mainashif
authored andcommitted
tests: msgq: Fix uncheck return value of coverity scan
Add a return value check of message queue test cases, to fix issue #31680, which is for CID :216795. Signed-off-by: Enjia Mai <[email protected]>
1 parent 0ab1372 commit 8595a39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/kernel/msgq/msgq_api/src/test_msgq_contexts.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,11 @@ void test_msgq_empty(void)
404404
*/
405405
ret = k_msgq_cleanup(&msgq1);
406406
zassert_equal(ret, -EBUSY, NULL);
407+
407408
/* put a message to wake that getting thread */
408-
k_msgq_put(&msgq1, &data[0], K_NO_WAIT);
409+
ret = k_msgq_put(&msgq1, &data[0], K_NO_WAIT);
410+
zassert_equal(ret, 0, NULL);
411+
409412
k_thread_abort(tid);
410413
}
411414

@@ -429,8 +432,9 @@ void test_msgq_full(void)
429432
ret = k_sem_init(&end_sema, 0, 1);
430433
zassert_equal(ret, 0, NULL);
431434

435+
ret = k_msgq_put(&msgq1, &data[0], K_NO_WAIT);
436+
zassert_equal(ret, 0, NULL);
432437

433-
k_msgq_put(&msgq1, &data[0], K_NO_WAIT);
434438
k_tid_t tid = k_thread_create(&tdata2, tstack2, STACK_SIZE,
435439
put_full_entry, &msgq1, NULL,
436440
NULL, pri, 0, K_NO_WAIT);

0 commit comments

Comments
 (0)