[PATCH 03/19] util: use cleanup label consistently in virHostdevNetConfigReplace()

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

 



This will make an upcoming functional change more straightforward.
---
 src/util/virhostdev.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 86ca8e0..a967182 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -411,15 +411,14 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Interface type hostdev is currently supported on"
                          " SR-IOV Virtual Functions only"));
-        return ret;
+        goto cleanup;
     }
 
     if (virHostdevNetDevice(hostdev, &linkdev, &vf) < 0)
-        return ret;
+        goto cleanup;
 
     vlan = virDomainNetGetActualVlan(hostdev->parent.data.net);
-    virtPort = virDomainNetGetActualVirtPortProfile(
-                                 hostdev->parent.data.net);
+    virtPort = virDomainNetGetActualVirtPortProfile(hostdev->parent.data.net);
     if (virtPort) {
         if (vlan) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -428,15 +427,21 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
                            virNetDevVPortTypeToString(virtPort->virtPortType));
             goto cleanup;
         }
-        ret = virHostdevNetConfigVirtPortProfile(linkdev, vf,
-                            virtPort, &hostdev->parent.data.net->mac, uuid,
-                            port_profile_associate);
+        if (virHostdevNetConfigVirtPortProfile(linkdev, vf, virtPort,
+                                               &hostdev->parent.data.net->mac,
+                                               uuid, port_profile_associate) < 0) {
+            goto cleanup;
+        }
     } else {
         /* Set only mac and vlan */
-        ret = virNetDevReplaceNetConfig(linkdev, vf,
-                                        &hostdev->parent.data.net->mac,
-                                        vlan, stateDir);
+        if (virNetDevReplaceNetConfig(linkdev, vf,
+                                      &hostdev->parent.data.net->mac,
+                                      vlan, stateDir) < 0) {
+            goto cleanup;
+        }
     }
+
+    ret = 0;
  cleanup:
     VIR_FREE(linkdev);
     return ret;
-- 
2.9.3

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



[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