[PATCH 10/12] vmware: virObjectUnlock usage cleanup

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

 



---
 src/vmware/vmware_driver.c | 51 ++++++++++++++++------------------------------
 1 file changed, 17 insertions(+), 34 deletions(-)

diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 6edc0bc..4d8bf3c 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -401,8 +401,7 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml)
     VIR_FREE(directoryName);
     VIR_FREE(fileName);
     VIR_FREE(vmxPath);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     vmwareDriverUnlock(driver);
     return dom;
 }
@@ -446,8 +445,7 @@ vmwareDomainShutdownFlags(virDomainPtr dom,
 
     ret = 0;
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     vmwareDriverUnlock(driver);
     return ret;
 }
@@ -515,8 +513,7 @@ vmwareDomainSuspend(virDomainPtr dom)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -564,8 +561,7 @@ vmwareDomainResume(virDomainPtr dom)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -612,8 +608,7 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -685,8 +680,7 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml,
     virDomainDefFree(vmdef);
     VIR_FREE(vmx);
     VIR_FREE(vmxPath);
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     vmwareDriverUnlock(driver);
     return dom;
 }
@@ -723,8 +717,7 @@ vmwareDomainCreateWithFlags(virDomainPtr dom,
     ret = vmwareStartVM(driver, vm);
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     vmwareDriverUnlock(driver);
     return ret;
 }
@@ -776,8 +769,7 @@ vmwareDomainUndefineFlags(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     vmwareDriverUnlock(driver);
     return ret;
 }
@@ -809,8 +801,7 @@ vmwareDomainLookupByID(virConnectPtr conn, int id)
         dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -833,8 +824,7 @@ vmwareDomainGetOSType(virDomainPtr dom)
     ignore_value(VIR_STRDUP(ret, vm->def->os.type));
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -860,8 +850,7 @@ vmwareDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
         dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -886,8 +875,7 @@ vmwareDomainLookupByName(virConnectPtr conn, const char *name)
         dom->id = vm->def->id;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return dom;
 }
 
@@ -908,8 +896,7 @@ vmwareDomainIsActive(virDomainPtr dom)
     ret = virDomainObjIsActive(obj);
 
  cleanup:
-    if (obj)
-        virObjectUnlock(obj);
+    virObjectUnlock(obj);
     return ret;
 }
 
@@ -931,8 +918,7 @@ vmwareDomainIsPersistent(virDomainPtr dom)
     ret = obj->persistent;
 
  cleanup:
-    if (obj)
-        virObjectUnlock(obj);
+    virObjectUnlock(obj);
     return ret;
 }
 
@@ -959,8 +945,7 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     ret = virDomainDefFormat(vm->def, flags);
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1095,8 +1080,7 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     return ret;
 }
 
@@ -1129,8 +1113,7 @@ vmwareDomainGetState(virDomainPtr dom,
     ret = 0;
 
  cleanup:
-    if (vm)
-        virObjectUnlock(vm);
+    virObjectUnlock(vm);
     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]