[libvirt] [PATCH v1 01/11] conf: Remove a redundant model/address-type check in mdev post parse

Erik Skultety eskultet at redhat.com
Wed Jun 27 13:34:38 UTC 2018


It's pointless to check the same thing multiple times.
Fix the indentation along the way too.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 src/conf/domain_conf.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d8cb7f37f3..d887df2c3e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4523,20 +4523,10 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr dev,
         if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
             return 0;
 
-        if (model == VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
-            dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-            virReportError(VIR_ERR_XML_ERROR,
-                           _("Unsupported address type '%s' with mediated "
-                             "device model '%s'"),
-                           virDomainDeviceAddressTypeToString(dev->info->type),
-                           virMediatedDeviceModelTypeToString(model));
-            return -1;
-        }
-
         if ((model == VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
-            dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) ||
+             dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) ||
             (model == VIR_MDEV_MODEL_TYPE_VFIO_CCW &&
-            dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
+             dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
             virReportError(VIR_ERR_XML_ERROR,
                            _("Unsupported address type '%s' with mediated "
                              "device model '%s'"),
-- 
2.14.4




More information about the libvir-list mailing list