|
|
fbe740 |
From 0b64dac1a3a9ef9cdfe3446ebbe114da1ae86e97 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <0b64dac1a3a9ef9cdfe3446ebbe114da1ae86e97@dist-git>
|
|
|
fbe740 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Date: Tue, 26 May 2020 10:59:19 +0200
|
|
|
fbe740 |
Subject: [PATCH] cpu_x86: Use g_auto* in virCPUx86GetHost
|
|
|
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 4a7f6f43a2a6144780d7ab74b8a6f6b008a7aa9d)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
Message-Id: <94056710375d491c42d12a46b20f670453c2a1c8.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, 6 insertions(+), 8 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
index 0aebe534e6..1ade53a4a8 100644
|
|
|
fbe740 |
--- a/src/cpu/cpu_x86.c
|
|
|
fbe740 |
+++ b/src/cpu/cpu_x86.c
|
|
|
fbe740 |
@@ -2637,18 +2637,18 @@ static int
|
|
|
fbe740 |
virCPUx86GetHost(virCPUDefPtr cpu,
|
|
|
fbe740 |
virDomainCapsCPUModelsPtr models)
|
|
|
fbe740 |
{
|
|
|
fbe740 |
- virCPUDataPtr cpuData = NULL;
|
|
|
fbe740 |
- int ret = -1;
|
|
|
fbe740 |
+ g_autoptr(virCPUData) cpuData = NULL;
|
|
|
fbe740 |
+ int ret;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (virCPUx86DriverInitialize() < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (!(cpuData = virCPUDataNew(archs[0])))
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
if (cpuidSet(CPUX86_BASIC, cpuData) < 0 ||
|
|
|
fbe740 |
cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
/* Read the IA32_ARCH_CAPABILITIES MSR (0x10a) if supported.
|
|
|
fbe740 |
* This is best effort since there might be no way to read the MSR
|
|
|
fbe740 |
@@ -2668,7 +2668,7 @@ virCPUx86GetHost(virCPUDefPtr cpu,
|
|
|
fbe740 |
};
|
|
|
fbe740 |
|
|
|
fbe740 |
if (virCPUx86DataAdd(cpuData, &item) < 0)
|
|
|
fbe740 |
- goto cleanup;
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
@@ -2684,8 +2684,6 @@ virCPUx86GetHost(virCPUDefPtr cpu,
|
|
|
fbe740 |
VIR_DEBUG("Host CPU does not support invariant TSC");
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
- cleanup:
|
|
|
fbe740 |
- virCPUx86DataFree(cpuData);
|
|
|
fbe740 |
return ret;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
#endif
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.26.2
|
|
|
fbe740 |
|