|
|
fbe740 |
From 2545e373c4a5b08836742742960244ece2586545 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <2545e373c4a5b08836742742960244ece2586545@dist-git>
|
|
|
fbe740 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Date: Tue, 26 May 2020 10:59:21 +0200
|
|
|
fbe740 |
Subject: [PATCH] cpu_x86: Use g_auto* in x86UpdateHostModel
|
|
|
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 2f9d15b495efdd9e63c07cd6fda611701e71ee46)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Message-Id: <f39c8eb1774d8c9af13a8af47689f8759ce57cb3.1590483392.git.jdenemar@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/cpu/cpu_x86.c | 14 +++++---------
|
|
|
fbe740 |
1 file changed, 5 insertions(+), 9 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
index 6e7311694d..98f7863b6f 100644
|
|
|
fbe740 |
--- a/src/cpu/cpu_x86.c
|
|
|
fbe740 |
+++ b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
@@ -2817,17 +2817,16 @@ static int
|
|
|
fbe740 |
x86UpdateHostModel(virCPUDefPtr guest,
|
|
|
fbe740 |
const virCPUDef *host)
|
|
|
fbe740 |
{
|
|
|
fbe740 |
- virCPUDefPtr updated = NULL;
|
|
|
fbe740 |
+ g_autoptr(virCPUDef) updated = NULL;
|
|
|
fbe740 |
size_t i;
|
|
|
fbe740 |
- int ret = -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(updated = virCPUDefCopyWithoutModel(host)))
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
updated->type = VIR_CPU_TYPE_GUEST;
|
|
|
fbe740 |
updated->mode = VIR_CPU_MODE_CUSTOM;
|
|
|
fbe740 |
if (virCPUDefCopyModel(updated, host, true) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (guest->vendor_id) {
|
|
|
fbe740 |
VIR_FREE(updated->vendor_id);
|
|
|
fbe740 |
@@ -2838,18 +2837,15 @@ x86UpdateHostModel(virCPUDefPtr guest,
|
|
|
fbe740 |
if (virCPUDefUpdateFeature(updated,
|
|
|
fbe740 |
guest->features[i].name,
|
|
|
fbe740 |
guest->features[i].policy) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
virCPUDefStealModel(guest, updated,
|
|
|
fbe740 |
guest->mode == VIR_CPU_MODE_CUSTOM);
|
|
|
fbe740 |
guest->mode = VIR_CPU_MODE_CUSTOM;
|
|
|
fbe740 |
guest->match = VIR_CPU_MATCH_EXACT;
|
|
|
fbe740 |
- ret = 0;
|
|
|
fbe740 |
|
|
|
fbe740 |
- cleanup:
|
|
|
fbe740 |
- virCPUDefFree(updated);
|
|
|
fbe740 |
- return ret;
|
|
|
fbe740 |
+ return 0;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.26.2
|
|
|
fbe740 |
|