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

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 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




[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