render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 2abd91246d3967f62473a9034f5d11f8e8ea8980 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <2abd91246d3967f62473a9034f5d11f8e8ea8980@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:59:14 +0200
a41c76
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86Compare
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit bc62d7a49141d745b19d066c07599f228020a0b3)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <548eeddbf9eabf5e4a872390189bb0adf746c75f.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 16 +++++++---------
a41c76
 1 file changed, 7 insertions(+), 9 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index 1a1c846383..c111ff45d4 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1847,32 +1847,30 @@ virCPUx86Compare(virCPUDefPtr host,
a41c76
                  virCPUDefPtr cpu,
a41c76
                  bool failIncompatible)
a41c76
 {
a41c76
-    virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
a41c76
-    char *message = NULL;
a41c76
+    virCPUCompareResult ret;
a41c76
+    g_autofree char *message = NULL;
a41c76
 
a41c76
     if (!host || !host->model) {
a41c76
         if (failIncompatible) {
a41c76
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
a41c76
                            _("unknown host CPU"));
a41c76
-        } else {
a41c76
-            VIR_WARN("unknown host CPU");
a41c76
-            ret = VIR_CPU_COMPARE_INCOMPATIBLE;
a41c76
+            return VIR_CPU_COMPARE_ERROR;
a41c76
         }
a41c76
-        goto cleanup;
a41c76
+
a41c76
+        VIR_WARN("unknown host CPU");
a41c76
+        return VIR_CPU_COMPARE_INCOMPATIBLE;
a41c76
     }
a41c76
 
a41c76
     ret = x86Compute(host, cpu, NULL, &message);
a41c76
 
a41c76
     if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
a41c76
-        ret = VIR_CPU_COMPARE_ERROR;
a41c76
         if (message)
a41c76
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
a41c76
         else
a41c76
             virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
a41c76
+        return VIR_CPU_COMPARE_ERROR;
a41c76
     }
a41c76
 
a41c76
- cleanup:
a41c76
-    VIR_FREE(message);
a41c76
     return ret;
a41c76
 }
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76