zephyr/tests/kernel/threads
Tom Hughes 81f5581a86 tests: kernel: thread_apis: Fix -Wsometimes-uninitialized warning
Building kernel.threads.apis with clang warns:

tests/kernel/threads/thread_apis/src/main.c:362:6: error: variable 'ret'
is used uninitialized whenever 'if' condition is true
[-Werror,-Wsometimes-uninitialized]
        if (m == ISR_ALREADY_EXIT || m == ISR_RUNNING) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/kernel/threads/thread_apis/src/main.c:380:6: note: uninitialized
use occurs here
        if (ret != 0) {
            ^~~
tests/kernel/threads/thread_apis/src/main.c:362:2: note: remove the 'if'
if its condition is always false
        if (m == ISR_ALREADY_EXIT || m == ISR_RUNNING) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests/kernel/threads/thread_apis/src/main.c:362:6: error: variable 'ret'
is used uninitialized whenever '||' condition is true
[-Werror,-Wsometimes-uninitialized]
        if (m == ISR_ALREADY_EXIT || m == ISR_RUNNING) {
            ^~~~~~~~~~~~~~~~~~~~~
tests/kernel/threads/thread_apis/src/main.c:380:6: note: uninitialized
use occurs here
        if (ret != 0) {
            ^~~
tests/kernel/threads/thread_apis/src/main.c:362:6: note: remove the '||'
if its condition is always false
        if (m == ISR_ALREADY_EXIT || m == ISR_RUNNING) {
            ^~~~~~~~~~~~~~~~~~~~~~~~
tests/kernel/threads/thread_apis/src/main.c:329:9: note: initialize the
variable 'ret' to silence this warning
        int ret;
               ^
                = 0

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-05 05:40:51 +01:00
..
dynamic_thread arch: define struct arch_esf and deprecate z_arch_esf_t 2024-06-04 14:02:51 -05:00
dynamic_thread_stack tests: kernel: Increase MAX_THREAD_BYTES to 6 2025-01-17 10:42:10 +01:00
no-multithreading
thread_apis tests: kernel: thread_apis: Fix -Wsometimes-uninitialized warning 2025-02-05 05:40:51 +01:00
thread_error_case tests: thread_error_case: fix incorrect userspace filtering 2024-11-20 15:58:15 -05:00
thread_init
thread_stack samples: tests: bluetooth: Add support for frdm_rw612 2024-06-10 07:02:06 -07:00
tls arch: kernel: lib: toolchain: Standardize TLS keyword 2024-09-23 10:01:48 +02:00