|
|
b971b8 |
From 2631931d1dc94aeab384d92bd00866de912c9b7d Mon Sep 17 00:00:00 2001
|
|
|
b971b8 |
Message-Id: <2631931d1dc94aeab384d92bd00866de912c9b7d@dist-git>
|
|
|
b971b8 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Date: Tue, 26 May 2020 10:59:22 +0200
|
|
|
b971b8 |
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86Update
|
|
|
b971b8 |
MIME-Version: 1.0
|
|
|
b971b8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
b971b8 |
Content-Transfer-Encoding: 8bit
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
b971b8 |
(cherry picked from commit e0244a786db265647ab6c1c37ca3852876e4b0a3)
|
|
|
b971b8 |
|
|
|
b971b8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
b971b8 |
Message-Id: <1d8ad3e099081c35a41e1013458fa52d8fb4fae0.1590483392.git.jdenemar@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
b971b8 |
---
|
|
|
b971b8 |
src/cpu/cpu_x86.c | 15 +++++----------
|
|
|
b971b8 |
1 file changed, 5 insertions(+), 10 deletions(-)
|
|
|
b971b8 |
|
|
|
b971b8 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
b971b8 |
index 98f7863b6f..1f7a8802f6 100644
|
|
|
b971b8 |
--- a/src/cpu/cpu_x86.c
|
|
|
b971b8 |
+++ b/src/cpu/cpu_x86.c
|
|
|
b971b8 |
@@ -2853,9 +2853,8 @@ static int
|
|
|
b971b8 |
virCPUx86Update(virCPUDefPtr guest,
|
|
|
b971b8 |
const virCPUDef *host)
|
|
|
b971b8 |
{
|
|
|
b971b8 |
- virCPUx86ModelPtr model = NULL;
|
|
|
b971b8 |
+ g_autoptr(virCPUx86Model) model = NULL;
|
|
|
b971b8 |
virCPUx86MapPtr map;
|
|
|
b971b8 |
- int ret = -1;
|
|
|
b971b8 |
size_t i;
|
|
|
b971b8 |
|
|
|
b971b8 |
if (!host) {
|
|
|
b971b8 |
@@ -2868,14 +2867,14 @@ virCPUx86Update(virCPUDefPtr guest,
|
|
|
b971b8 |
return -1;
|
|
|
b971b8 |
|
|
|
b971b8 |
if (!(model = x86ModelFromCPU(host, map, -1)))
|
|
|
b971b8 |
- goto cleanup;
|
|
|
b971b8 |
+ return -1;
|
|
|
b971b8 |
|
|
|
b971b8 |
for (i = 0; i < guest->nfeatures; i++) {
|
|
|
b971b8 |
if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
|
|
|
b971b8 |
int supported = x86FeatureInData(guest->features[i].name,
|
|
|
b971b8 |
&model->data, map);
|
|
|
b971b8 |
if (supported < 0)
|
|
|
b971b8 |
- goto cleanup;
|
|
|
b971b8 |
+ return -1;
|
|
|
b971b8 |
else if (supported)
|
|
|
b971b8 |
guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
|
|
|
b971b8 |
else
|
|
|
b971b8 |
@@ -2885,13 +2884,9 @@ virCPUx86Update(virCPUDefPtr guest,
|
|
|
b971b8 |
|
|
|
b971b8 |
if (guest->mode == VIR_CPU_MODE_HOST_MODEL ||
|
|
|
b971b8 |
guest->match == VIR_CPU_MATCH_MINIMUM)
|
|
|
b971b8 |
- ret = x86UpdateHostModel(guest, host);
|
|
|
b971b8 |
- else
|
|
|
b971b8 |
- ret = 0;
|
|
|
b971b8 |
+ return x86UpdateHostModel(guest, host);
|
|
|
b971b8 |
|
|
|
b971b8 |
- cleanup:
|
|
|
b971b8 |
- x86ModelFree(model);
|
|
|
b971b8 |
- return ret;
|
|
|
b971b8 |
+ return 0;
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
|
|
|
b971b8 |
--
|
|
|
b971b8 |
2.26.2
|
|
|
b971b8 |
|