From 2871c87aaec004cf4fe8e61a8d15c35b6d8ab677 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 11 Jun 2024 21:02:50 -0400 Subject: [PATCH] tests: poll: fix misconstructed k_poll_event test Since commit 0c23cf94a43b ("include/kernel: check type of object passed to K_POLL_EVENT_INITIALIZER") it is no longer possible to use arbitrary type literals with the initializer macro. Misconstructing a k_poll_event type for test purpose must be done explicitly. Signed-off-by: Nicolas Pitre --- tests/kernel/poll/src/test_poll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/kernel/poll/src/test_poll.c b/tests/kernel/poll/src/test_poll.c index 8af64040a0c..5282b296c18 100644 --- a/tests/kernel/poll/src/test_poll.c +++ b/tests/kernel/poll/src/test_poll.c @@ -115,10 +115,13 @@ ZTEST_USER(poll_api_1cpu, test_poll_no_wait) -EINVAL, NULL); + /* can't use the initializer to misconstruct this */ struct k_poll_event bad_events2[] = { - K_POLL_EVENT_INITIALIZER(0xFU, - K_POLL_MODE_NOTIFY_ONLY, - &no_wait_sem), + { .type = 0xFU, + .state = K_POLL_STATE_NOT_READY, + .mode = K_POLL_MODE_NOTIFY_ONLY, + .obj = &no_wait_sem, + }, }; zassert_equal(k_poll(bad_events2, ARRAY_SIZE(bad_events), K_NO_WAIT), -EINVAL,