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

[libvirt PATCH 12/15] cpu_ppc64: Use g_auto* in ppc64DriverDecode



Signed-off-by: Tim Wiederhake <twiederh redhat com>
---
 src/cpu/cpu_ppc64.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index aef1418872..d7ccd506fb 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -563,8 +563,7 @@ ppc64DriverDecode(virCPUDefPtr cpu,
                   const virCPUData *data,
                   virDomainCapsCPUModelsPtr models)
 {
-    int ret = -1;
-    ppc64_map *map;
+    g_autoptr(ppc64_map) map = NULL;
     const ppc64_model *model;
 
     if (!data || !(map = ppc64LoadMap()))
@@ -574,26 +573,21 @@ ppc64DriverDecode(virCPUDefPtr cpu,
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Cannot find CPU model with PVR 0x%08x"),
                        data->data.ppc64.pvr[0].value);
-        goto cleanup;
+        return -1;
     }
 
     if (!virCPUModelIsAllowed(model->name, models)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("CPU model %s is not supported by hypervisor"),
                        model->name);
-        goto cleanup;
+        return -1;
     }
 
     cpu->model = g_strdup(model->name);
     if (model->vendor)
         cpu->vendor = g_strdup(model->vendor->name);
 
-    ret = 0;
-
- cleanup:
-    ppc64MapFree(map);
-
-    return ret;
+    return 0;
 }
 
 static void
-- 
2.26.2


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