pci-hotplug: initialize dinfo to NULL in pci_device_hot_add

Submitted by Sebastian Herbszt on Aug. 16, 2009, 12:07 p.m.

Details

Message ID 47AA2367F2864C4D8A6B856E35FA189D@FSCPC
State Superseded
Headers show

Commit Message

Sebastian Herbszt Aug. 16, 2009, 12:07 p.m.
Suppress the following compiler warning emitted by at least gcc version 4.2.1 (SUSE Linux)
and gcc version 3.4.5 (mingw32 special):

hw/pci-hotplug.c: In function 'pci_device_hot_add':
hw/pci-hotplug.c:102: warning: 'dinfo' may be used uninitialized in this function
hw/pci-hotplug.c:102: note: 'dinfo' was declared here

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>

Comments

Sebastian Herbszt Aug. 21, 2009, 7:09 p.m.
Sebastian Herbszt wrote:
> Suppress the following compiler warning emitted by at least gcc version 4.2.1 (SUSE Linux)
> and gcc version 3.4.5 (mingw32 special):
> 
> hw/pci-hotplug.c: In function 'pci_device_hot_add':
> hw/pci-hotplug.c:102: warning: 'dinfo' may be used uninitialized in this function
> hw/pci-hotplug.c:102: note: 'dinfo' was declared here

Still needed for v0.11.0-rc0-373-g6b74327.

- Sebastian

Patch hide | download patch | download mbox

--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -99,7 +99,7 @@  static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
                                            const char *opts)
 {
     PCIDevice *dev;
-    DriveInfo *dinfo;
+    DriveInfo *dinfo = NULL;
     int type = -1;
     char buf[128];