Commit 81f5581
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 <[email protected]>1 parent 7b09cce commit 81f5581
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
0 commit comments