[libvirt PATCH 06/11] ch: Prepare virCHDriverGetCapabilities for automatic mutex management

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

 



No functional change intended. This change makes the refactoring to
automatic mutex management easier to follow.

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/ch/ch_conf.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index be12934dcd..cdf69e3e70 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -87,21 +87,22 @@ virCaps *virCHDriverCapsInit(void)
 virCaps *virCHDriverGetCapabilities(virCHDriver *driver,
                                       bool refresh)
 {
-    virCaps *ret;
-    if (refresh) {
-        virCaps *caps = NULL;
-        if ((caps = virCHDriverCapsInit()) == NULL)
-            return NULL;
+    virCaps *ret = NULL;
+    virCaps *caps = NULL;
 
-        chDriverLock(driver);
+    if (refresh && !(caps = virCHDriverCapsInit()))
+        return NULL;
+
+    chDriverLock(driver);
+
+    if (refresh) {
         virObjectUnref(driver->caps);
         driver->caps = caps;
-    } else {
-        chDriverLock(driver);
     }
 
     ret = virObjectRef(driver->caps);
     chDriverUnlock(driver);
+
     return ret;
 }
 
-- 
2.31.1




[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