|
|
fbe740 |
From 5f9b035adcf2813beb6cc82200b745f5e34acd8d Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <5f9b035adcf2813beb6cc82200b745f5e34acd8d@dist-git>
|
|
|
fbe740 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Date: Tue, 26 May 2020 10:59:25 +0200
|
|
|
fbe740 |
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86ExpandFeatures
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit ff6897c84504a3e663759d710968ad1f72bc9208)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Message-Id: <d82daa166403fda2bcd89c68478162b45d8b9711.1590483392.git.jdenemar@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/cpu/cpu_x86.c | 22 ++++++++--------------
|
|
|
fbe740 |
1 file changed, 8 insertions(+), 14 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
index c4654c8d4c..917cf857a6 100644
|
|
|
fbe740 |
--- a/src/cpu/cpu_x86.c
|
|
|
fbe740 |
+++ b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
@@ -3055,30 +3055,29 @@ static int
|
|
|
fbe740 |
virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
|
|
fbe740 |
{
|
|
|
fbe740 |
virCPUx86MapPtr map;
|
|
|
fbe740 |
- virCPUDefPtr expanded = NULL;
|
|
|
fbe740 |
- virCPUx86ModelPtr model = NULL;
|
|
|
fbe740 |
+ g_autoptr(virCPUDef) expanded = NULL;
|
|
|
fbe740 |
+ g_autoptr(virCPUx86Model) model = NULL;
|
|
|
fbe740 |
bool host = cpu->type == VIR_CPU_TYPE_HOST;
|
|
|
fbe740 |
size_t i;
|
|
|
fbe740 |
- int ret = -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(map = virCPUx86GetMap()))
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(expanded = virCPUDefCopy(cpu)))
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
virCPUDefFreeFeatures(expanded);
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(model = x86ModelFind(map, cpu->model))) {
|
|
|
fbe740 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
fbe740 |
_("unknown CPU model %s"), cpu->model);
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(model = x86ModelCopy(model)) ||
|
|
|
fbe740 |
x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE,
|
|
|
fbe740 |
&model->data, map) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
for (i = 0; i < cpu->nfeatures; i++) {
|
|
|
fbe740 |
virCPUFeatureDefPtr f = cpu->features + i;
|
|
|
fbe740 |
@@ -3089,17 +3088,12 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
|
|
fbe740 |
continue;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (virCPUDefUpdateFeature(expanded, f->name, f->policy) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
virCPUDefFreeModel(cpu);
|
|
|
fbe740 |
|
|
|
fbe740 |
- ret = virCPUDefCopyModel(cpu, expanded, false);
|
|
|
fbe740 |
-
|
|
|
fbe740 |
- cleanup:
|
|
|
fbe740 |
- virCPUDefFree(expanded);
|
|
|
fbe740 |
- x86ModelFree(model);
|
|
|
fbe740 |
- return ret;
|
|
|
fbe740 |
+ return virCPUDefCopyModel(cpu, expanded, false);
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.26.2
|
|
|
fbe740 |
|