tests: lib: notify: Fix uninitialised variable warning

This commit sets an initial value of 0 for the `res` variable, whose
pointer is passed to other functions and is not directly assigned
within the calling function.

Note that, when the test completes successfully, the value of the `res`
variable should be set to `423` (the value of `set_res`).

This fixes the "‘res’ may be used uninitialized" warning generated by
the GCC 12.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2022-07-29 20:23:04 +09:00 committed by Fabio Baltieri
parent 687e5a7158
commit bde270b1d5
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ ZTEST(sys_notify_api, test_spinwait)
{
int rc;
int set_res = 423;
int res;
int res = 0;
sys_notify_generic_callback cb;
struct sys_notify notify;
uint32_t xflags = 0x1234;