[libvirt PATCH 6/8] lxc: remove cleanup from lxcNodeGetSecurityModel

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

 



Return the values directly.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/lxc/lxc_driver.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 0d438de4a5..aa4bdd68ac 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1220,32 +1220,26 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
 {
     virLXCDriver *driver = conn->privateData;
     g_autoptr(virCaps) caps = NULL;
-    int ret = 0;
 
     memset(secmodel, 0, sizeof(*secmodel));
 
-    if (virNodeGetSecurityModelEnsureACL(conn) < 0) {
-        ret = -1;
-        goto cleanup;
-    }
+    if (virNodeGetSecurityModelEnsureACL(conn) < 0)
+        return -1;
 
-    if (!(caps = virLXCDriverGetCapabilities(driver, false))) {
-        ret = -1;
-        goto cleanup;
-    }
+    if (!(caps = virLXCDriverGetCapabilities(driver, false)))
+        return -1;
 
     /* we treat no driver as success, but simply return no data in *secmodel */
     if (caps->host.nsecModels == 0
         || caps->host.secModels[0].model == NULL)
-        goto cleanup;
+        return 0;
 
     if (virStrcpy(secmodel->model, caps->host.secModels[0].model,
                   VIR_SECURITY_MODEL_BUFLEN) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security model string exceeds max %d bytes"),
                        VIR_SECURITY_MODEL_BUFLEN - 1);
-        ret = -1;
-        goto cleanup;
+        return -1;
     }
 
     if (virStrcpy(secmodel->doi, caps->host.secModels[0].doi,
@@ -1253,12 +1247,10 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("security DOI string exceeds max %d bytes"),
                        VIR_SECURITY_DOI_BUFLEN-1);
-        ret = -1;
-        goto cleanup;
+        return -1;
     }
 
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
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