[PATCH 09/12] uml: virObjectUnlock usage cleanup

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

 



---
 src/uml/uml_driver.c | 81 ++++++++++++++++++----------------------------------
 1 file changed, 27 insertions(+), 54 deletions(-)

diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 1e0ec0e..3befd12 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -406,8 +406,7 @@ umlInotifyEvent(int watch,
                 }
             }
         }
-        if (dom)
-            virObjectUnlock(dom);
+        virObjectUnlock(dom);
         if (event) {
             umlDomainEventQueue(driver, event);
             event = NULL;
@@ -748,8 +747,7 @@ static void umlProcessAutoDestroyDom(void *payload,
     if (dom && !dom->persistent)
         virDomainObjListRemove(data->driver->domains, dom);
 
-    if (dom)
-        virObjectUnlock(dom);
+    virObjectUnlock(dom);
     if (event)
         umlDomainEventQueue(data->driver, event);
     virHashRemoveEntry(data->driver->autodestroy, uuidstr);
@@ -1372,8 +1370,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
     if (dom) dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -1400,8 +1397,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
     if (dom) dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -1428,8 +1424,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
     if (dom) dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -1454,8 +1449,7 @@ static int umlDomainIsActive(virDomainPtr dom)
     ret = virDomainObjIsActive(obj);
 
  cleanup:
-    if (obj)
-        virObjectUnlock(obj);
+    virObjectUnlock(obj);
     return ret;
 }
 
@@ -1480,8 +1474,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
     ret = obj->persistent;
 
  cleanup:
-    if (obj)
-        virObjectUnlock(obj);
+    virObjectUnlock(obj);
     return ret;
 }
 
@@ -1505,8 +1498,7 @@ static int umlDomainIsUpdated(virDomainPtr dom)
     ret = obj->updated;
 
  cleanup:
-    if (obj)
-        virObjectUnlock(obj);
+    virObjectUnlock(obj);
     return ret;
 }
 
@@ -1625,8 +1617,7 @@ static virDomainPtr umlDomainCreateXML(virConnectPtr conn, const char *xml,
 
  cleanup:
     virDomainDefFree(def);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     if (event)
         umlDomainEventQueue(driver, event);
     umlDriverUnlock(driver);
@@ -1668,8 +1659,7 @@ static int umlDomainShutdownFlags(virDomainPtr dom,
 
  cleanup:
     VIR_FREE(info);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1714,8 +1704,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     if (event)
         umlDomainEventQueue(driver, event);
     umlDriverUnlock(driver);
@@ -1750,8 +1739,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
         goto cleanup;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return type;
 }
 
@@ -1782,8 +1770,7 @@ umlDomainGetMaxMemory(virDomainPtr dom)
     ret = vm->def->mem.max_balloon;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1819,8 +1806,7 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1862,8 +1848,7 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1905,8 +1890,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1940,8 +1924,7 @@ umlDomainGetState(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1973,8 +1956,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
                              flags);
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -2043,8 +2025,7 @@ static int umlDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
                                          VIR_DOMAIN_EVENT_STARTED_BOOTED);
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     if (event)
         umlDomainEventQueue(driver, event);
     umlDriverUnlock(driver);
@@ -2093,8 +2074,7 @@ static virDomainPtr umlDomainDefineXML(virConnectPtr conn, const char *xml)
 
  cleanup:
     virDomainDefFree(def);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return dom;
 }
@@ -2138,8 +2118,7 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -2251,8 +2230,7 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
  cleanup:
 
     virDomainDeviceDefFree(dev);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -2366,8 +2344,7 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml)
 
  cleanup:
     virDomainDeviceDefFree(dev);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -2413,8 +2390,7 @@ static int umlDomainGetAutostart(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -2483,8 +2459,7 @@ static int umlDomainSetAutostart(virDomainPtr dom,
  cleanup:
     VIR_FREE(configFile);
     VIR_FREE(autostartLink);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
@@ -2554,8 +2529,7 @@ umlDomainBlockPeek(virDomainPtr dom,
 
  cleanup:
     VIR_FORCE_CLOSE(fd);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -2627,8 +2601,7 @@ umlDomainOpenConsole(virDomainPtr dom,
 
     ret = 0;
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     umlDriverUnlock(driver);
     return ret;
 }
-- 
1.9.0

--
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]