Skip to content

Commit 73dccf6

Browse files
committed
tests: kernel: sleep: Fix uninitialised variable warning
This commit sets an initial value of 0 for the `elapsed_ms` variable, which may be used uninitialised when the while loop below does not execute. This fixes the "‘elapsed_ms’ may be used uninitialized" warning generated by the GCC 12. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent 33cbd84 commit 73dccf6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/kernel/sleep/src/usleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
ZTEST_USER(sleep, test_usleep)
6666
{
6767
int retries = 0;
68-
int64_t elapsed_ms;
68+
int64_t elapsed_ms = 0;
6969

7070
while (retries < RETRIES) {
7171
int64_t start_ms;

0 commit comments

Comments
 (0)