]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuValidateDomainDeviceDefVideo: Refactor condition checking for qxl and virtio-vga
authorPeter Krempa <pkrempa@redhat.com>
Tue, 18 Jan 2022 15:58:35 +0000 (16:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 19 Jan 2022 15:54:32 +0000 (16:54 +0100)
Subsequent patch will use the same condition so move the primary device
check into a nested condition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_validate.c

index a4a6608779d9791e59d8171618debf9d988b287d..b5783e84ada7a715549b2aa25fb01afc285be38f 100644 (file)
@@ -2472,14 +2472,14 @@ qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video,
         return -1;
     }
 
-    if (!video->primary &&
-        video->type != VIR_DOMAIN_VIDEO_TYPE_QXL &&
+    if (video->type != VIR_DOMAIN_VIDEO_TYPE_QXL &&
         video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("video type '%s' is only valid as primary "
-                         "video device"),
-                       virDomainVideoTypeToString(video->type));
-        return -1;
+        if (!video->primary) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("video type '%s' is only valid as primary video device"),
+                           virDomainVideoTypeToString(video->type));
+            return -1;
+        }
     }
 
     if (video->accel && video->accel->accel2d == VIR_TRISTATE_SWITCH_ON) {