Don't check the type twice, move the chardev validation into the switch. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_validate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 5973f019d2..9865e29637 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -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; } -- 2.31.1