-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Backport v4.3-branch] drivers: xen: Fix uninitialized variable warning #100907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4.3-branch
Are you sure you want to change the base?
Conversation
gcc complains about the posibility of ret and gfn being used
unitialiazed (with the input npages == 0).
Let's fix it by initializing ret to 0.
The warnings being:
```
zephyr/CMakeFiles/zephyr.dir/drivers/xen/gnttab.c.obj
In file included from include/zephyr/logging/log.h:11,
from drivers/xen/gnttab.c:31:
include/zephyr/logging/log_core.h: In function 'gnttab_get_pages':
include/zephyr/logging/log_core.h:221:9: warning: 'gfn' may be used
uninitialized [-Wmaybe-uninitialized]
221 | z_log_minimal_printk("%c: " fmt "\n", \
| ^~~~~~~~~~~~~~~~~~~~
drivers/xen/gnttab.c:202:19: note: 'gfn' was declared here
202 | xen_pfn_t gfn;
| ^~~
include/zephyr/logging/log_core.h:221:9: warning: 'ret' may be used
uninitialized [-Wmaybe-uninitialized]
221 | z_log_minimal_printk("%c: " fmt "\n", \
| ^~~~~~~~~~~~~~~~~~~~
drivers/xen/gnttab.c:199:13: note: 'ret' was declared here
199 | int ret;
| ^~~
```
Signed-off-by: Alberto Escolar Piedras <[email protected]>
(cherry picked from commit 139b7c2)
|
|
@aescolar I'm a little bit confused by this, as I can see in #100737 and in logs CI was not happy with 2 variables uninitialized: But the only |
Yes. |



Backport 139b7c2 from #100737.
Fixes #101048