]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuValidateDomainSmartcardDef: Move chardev validation under VIR_DOMAIN_SMARTCARD_TY...
authorPeter Krempa <pkrempa@redhat.com>
Mon, 11 Oct 2021 14:37:56 +0000 (16:37 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Oct 2021 18:54:53 +0000 (20:54 +0200)
Don't check the type twice, move the chardev validation into the
switch.

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

index 5973f019d22fe13ba408e94369ea36053d1e2996..9865e2963760348f38593fe1ab345cb196aba11f 100644 (file)
@@ -2112,6 +2112,9 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *def,
                            _("this QEMU binary lacks smartcard passthrough mode support"));
             return -1;
         }
+
+        if (qemuValidateDomainChrSourceDef(def->data.passthru, qemuCaps) < 0)
+            return -1;
         break;
 
     default:
@@ -2119,10 +2122,6 @@ qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *def,
         return -1;
     }
 
-    if (def->type == VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH &&
-        qemuValidateDomainChrSourceDef(def->data.passthru, qemuCaps) < 0)
-        return -1;
-
     return 0;
 }