]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyve: bhyveConnectCompareCPU: remove cleanup label
authorJán Tomko <jtomko@redhat.com>
Fri, 10 Dec 2021 15:12:59 +0000 (16:12 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 13 Dec 2021 13:44:01 +0000 (14:44 +0100)
Return the desired values directly and clean up the redundant
else branches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/bhyve/bhyve_driver.c

index e445c8cadfafbc8861e4b71ac751c386143567d6..cb1544665e18d83da0833a5b9e29eb0c192b18f4 100644 (file)
@@ -1431,7 +1431,6 @@ bhyveConnectCompareCPU(virConnectPtr conn,
                        unsigned int flags)
 {
     struct _bhyveConn *driver = conn->privateData;
-    int ret = VIR_CPU_COMPARE_ERROR;
     g_autoptr(virCaps) caps = NULL;
     bool failIncompatible;
     bool validateXML;
@@ -1441,30 +1440,27 @@ bhyveConnectCompareCPU(virConnectPtr conn,
                   VIR_CPU_COMPARE_ERROR);
 
     if (virConnectCompareCPUEnsureACL(conn) < 0)
-        goto cleanup;
+        return VIR_CPU_COMPARE_ERROR;
 
     failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE);
     validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
 
     if (!(caps = bhyveDriverGetCapabilities(driver)))
-        goto cleanup;
+        return VIR_CPU_COMPARE_ERROR;
 
     if (!caps->host.cpu ||
         !caps->host.cpu->model) {
         if (failIncompatible) {
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
                            _("cannot get host CPU capabilities"));
-        } else {
-            VIR_WARN("cannot get host CPU capabilities");
-            ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+            return VIR_CPU_COMPARE_ERROR;
         }
-    } else {
-        ret = virCPUCompareXML(caps->host.arch, caps->host.cpu,
-                               xmlDesc, failIncompatible, validateXML);
+        VIR_WARN("cannot get host CPU capabilities");
+        return VIR_CPU_COMPARE_INCOMPATIBLE;
     }
 
- cleanup:
-    return ret;
+    return virCPUCompareXML(caps->host.arch, caps->host.cpu,
+                            xmlDesc, failIncompatible, validateXML);
 }
 
 static int