]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: address: Handle all the video devices within a single loop
authorErik Skultety <eskultet@redhat.com>
Wed, 23 May 2018 13:55:36 +0000 (15:55 +0200)
committerErik Skultety <eskultet@redhat.com>
Mon, 9 Jul 2018 16:59:02 +0000 (18:59 +0200)
Since 133fb140 moved the validation of a video device into a separate
function, the code handling PCI slot assignment for video devices has
been the same for both the primary device and the secondary devices.
Let's merge these and thus handle all the devices within the existing
'for' loop.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain_address.c

index eb11a660d7c762c03e374855d59ee7e7a8fac786..6ea80616af1f3301d817c8bddf435ed34af91492 100644 (file)
@@ -2081,15 +2081,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             goto error;
     }
 
-    /* Assign a PCI slot to the primary video card if there is not an
-     * assigned address. */
-    if (def->nvideos > 0 &&
-        virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
-        if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->info) < 0)
-            goto error;
-    }
+    /* Video devices */
+    for (i = 0; i < def->nvideos; i++) {
 
-    for (i = 1; i < def->nvideos; i++) {
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
             continue;