]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Fix initialization value of 'multi' in PCI address
authorXian Han Yu <xhyubj@linux.vnet.ibm.com>
Mon, 15 Aug 2016 04:22:25 +0000 (06:22 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 2 Sep 2016 14:43:00 +0000 (16:43 +0200)
The 'multi' element in PCI address struct used as 'virTristateSwitch',
and its default value is 'VIR_TRISTATE_SWITCH_ABSENT'. Current PCI
process use 'false' to initialization 'multi', which is ambiguously
for assignment or comparison. This patch use '{0}' to initialize
the whole PCI address struct, which fix the 'multi' initialization
and makes code more simplify and explicitly.

Signed-off-by: Xian Han Yu <xhyubj@linux.vnet.ibm.com>
src/conf/domain_addr.c
src/conf/node_device_conf.c
src/qemu/qemu_domain_address.c

index c1b5580bea36424a97c67bdb9dbbe30527be1b82..79c024f135eca9fd8130cfa2ea00d594c9698e85 100644 (file)
@@ -590,7 +590,7 @@ virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
     /* default to starting the search for a free slot from
      * the first slot of domain 0 bus 0...
      */
-    virPCIDeviceAddress a = { 0, 0, 0, 0, false };
+    virPCIDeviceAddress a = {0};
     char *addrStr = NULL;
 
     if (addrs->nbuses == 0) {
index 719abcd21c4666a36a587ee64e6f9b27f99dd561..1cd0bafb9398d724c5d9bb9c0c81134e019a1ebd 100644 (file)
@@ -1164,7 +1164,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
         goto cleanup;
 
     for (i = 0; i < nAddrNodes; i++) {
-        virPCIDeviceAddress addr = { 0, 0, 0, 0, 0 };
+        virPCIDeviceAddress addr = {0};
         if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0)
             goto cleanup;
         if (VIR_ALLOC(pciAddr) < 0)
index 3d52d72e8ed569d51e2bc7602730607a4b104574..bb16738350ddd27b1ab0f5acc51c893640982888 100644 (file)
@@ -1096,7 +1096,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 
         /* USB2 needs special handling to put all companions in the same slot */
         if (IS_USB2_CONTROLLER(def->controllers[i])) {
-            virPCIDeviceAddress addr = { 0, 0, 0, 0, false };
+            virPCIDeviceAddress addr = {0};
             bool foundAddr = false;
 
             memset(&tmp_addr, 0, sizeof(tmp_addr));