[libvirt] [RFC PATCH 1/7] conf: Remove a redundant model/address-type check in mdev post parse

Erik Skultety posted 7 patches 6 years, 11 months ago
[libvirt] [RFC PATCH 1/7] conf: Remove a redundant model/address-type check in mdev post parse
Posted by Erik Skultety 6 years, 11 months ago
It's pointless to check the same thing multiple times.
Fix the indentation along the way too.

Signed-off-by: Erik Skultety <eskultet@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 544f63a2a9..62bd17739c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4513,20 +4513,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.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 1/7] conf: Remove a redundant model/address-type check in mdev post parse
Posted by John Ferlan 6 years, 11 months ago

On 05/30/2018 09:42 AM, Erik Skultety wrote:
> It's pointless to check the same thing multiple times.
> Fix the indentation along the way too.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/conf/domain_conf.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list