[libvirt] [PATCH v2 6/9] hostdev: Minor style adjustments

Andrea Bolognani abologna at redhat.com
Mon Jan 25 16:21:01 UTC 2016


Mostly labels names and whitespace.

No functional changes.
---
 src/util/virhostdev.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 5ded1e9..ab17547 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -838,9 +838,10 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
     }
 
  cleanup:
+    virObjectUnref(pcidevs);
     virObjectUnlock(hostdev_mgr->activePCIHostdevs);
     virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
-    virObjectUnref(pcidevs);
+
     return ret;
 }
 
@@ -1671,7 +1672,7 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
     virObjectLock(hostdev_mgr->inactivePCIHostdevs);
 
     if (virHostdevIsPCINodeDeviceUsed(virPCIDeviceGetAddress(pci), &data))
-        goto out;
+        goto cleanup;
 
     /* We want this function to be idempotent, so if the device has already
      * been added to the inactive list (and is not active, as per the check
@@ -1680,19 +1681,21 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr,
         VIR_DEBUG("PCI device %s is already detached from the host",
                   virPCIDeviceGetName(pci));
         ret = 0;
-        goto out;
+        goto cleanup;
     }
 
     /* Detach the device. We don't want to skip unmanaged devices in
      * this case, because the user explicitly asked for the device to
      * be detached from the host driver */
     if (virHostdevOnlyDetachPCIDevice(hostdev_mgr, pci, false) < 0)
-        goto out;
+        goto cleanup;
 
     ret = 0;
- out:
+
+ cleanup:
     virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
     virObjectUnlock(hostdev_mgr->activePCIHostdevs);
+
     return ret;
 }
 
@@ -1722,7 +1725,7 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
     virObjectLock(hostdev_mgr->inactivePCIHostdevs);
 
     if (virHostdevIsPCINodeDeviceUsed(virPCIDeviceGetAddress(pci), &data))
-        goto out;
+        goto cleanup;
 
     /* We want this function to be idempotent, so if the device has already
      * been removed from the inactive list (and is not active either, as
@@ -1734,19 +1737,21 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr,
         VIR_DEBUG("PCI device %s is already attached to the host",
                   virPCIDeviceGetName(pci));
         ret = 0;
-        goto out;
+        goto cleanup;
     }
 
     /* Reattach the device. We don't want to skip unmanaged devices in
      * this case, because the user explicitly asked for the device to
      * be reattached to the host driver */
     if (virHostdevOnlyReattachPCIDevice(hostdev_mgr, actual, false) < 0)
-        goto out;
+        goto cleanup;
 
     ret = 0;
- out:
+
+ cleanup:
     virObjectUnlock(hostdev_mgr->inactivePCIHostdevs);
     virObjectUnlock(hostdev_mgr->activePCIHostdevs);
+
     return ret;
 }
 
-- 
2.5.0




More information about the libvir-list mailing list