[PATCH 4/5] qemuValidateDomainDeviceDefVideo: Refactor condition checking for qxl and virtio-vga

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subsequent patch will use the same condition so move the primary device
check into a nested condition.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_validate.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 3a69733f81..5b2af94890 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -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) {
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux