Building arch/x86/lguest/boot.o triggers two warnings: arch/x86/lguest/boot.c: In function 'early_put_chars': arch/x86/lguest/boot.c:1300:5: warning: 'device_len' may be used uninitialized in this function [-Wmaybe-uninitialized] if (device_len < (offsetof(struct virtio_console_config, emerg_wr) ^ arch/x86/lguest/boot.c:1238:6: note: 'device_len' was declared here u32 device_len; ^ arch/x86/lguest/boot.c:1306:21: warning: 'device_offset' may be used uninitialized in this function [-Wmaybe-uninitialized] console_cfg_offset = device_offset; ^ arch/x86/lguest/boot.c:1237:6: note: 'device_offset' was declared here u32 device_offset; ^
These annoy me for some time now. So I investigated whether probe_pci_console(), which actually triggers these warnings, could be reorganized to make these warnings go away. (Because I really dislike to initialize variables to some default value just to shut up the compiler.) I came up with this short series. It makes, I think, the code clearer for the people reading it. And as a bonus the compiler is silent now. Paul Bolle (2): lguest: read length of device_cap later lguest: read offset of device_cap later arch/x86/lguest/boot.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) -- 2.4.3