mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-11 04:15:49 +00:00
bhyve: bhyveConnectCompareCPU: remove cleanup label
Return the desired values directly and clean up the redundant else branches. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1852cee52b
commit
8a82117ee2
@ -1431,7 +1431,6 @@ bhyveConnectCompareCPU(virConnectPtr conn,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
struct _bhyveConn *driver = conn->privateData;
|
struct _bhyveConn *driver = conn->privateData;
|
||||||
int ret = VIR_CPU_COMPARE_ERROR;
|
|
||||||
g_autoptr(virCaps) caps = NULL;
|
g_autoptr(virCaps) caps = NULL;
|
||||||
bool failIncompatible;
|
bool failIncompatible;
|
||||||
bool validateXML;
|
bool validateXML;
|
||||||
@ -1441,30 +1440,27 @@ bhyveConnectCompareCPU(virConnectPtr conn,
|
|||||||
VIR_CPU_COMPARE_ERROR);
|
VIR_CPU_COMPARE_ERROR);
|
||||||
|
|
||||||
if (virConnectCompareCPUEnsureACL(conn) < 0)
|
if (virConnectCompareCPUEnsureACL(conn) < 0)
|
||||||
goto cleanup;
|
return VIR_CPU_COMPARE_ERROR;
|
||||||
|
|
||||||
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE);
|
failIncompatible = !!(flags & VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE);
|
||||||
validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
|
validateXML = !!(flags & VIR_CONNECT_COMPARE_CPU_VALIDATE_XML);
|
||||||
|
|
||||||
if (!(caps = bhyveDriverGetCapabilities(driver)))
|
if (!(caps = bhyveDriverGetCapabilities(driver)))
|
||||||
goto cleanup;
|
return VIR_CPU_COMPARE_ERROR;
|
||||||
|
|
||||||
if (!caps->host.cpu ||
|
if (!caps->host.cpu ||
|
||||||
!caps->host.cpu->model) {
|
!caps->host.cpu->model) {
|
||||||
if (failIncompatible) {
|
if (failIncompatible) {
|
||||||
virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
|
virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s",
|
||||||
_("cannot get host CPU capabilities"));
|
_("cannot get host CPU capabilities"));
|
||||||
} else {
|
return VIR_CPU_COMPARE_ERROR;
|
||||||
VIR_WARN("cannot get host CPU capabilities");
|
|
||||||
ret = VIR_CPU_COMPARE_INCOMPATIBLE;
|
|
||||||
}
|
}
|
||||||
} else {
|
VIR_WARN("cannot get host CPU capabilities");
|
||||||
ret = virCPUCompareXML(caps->host.arch, caps->host.cpu,
|
return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||||
xmlDesc, failIncompatible, validateXML);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
return virCPUCompareXML(caps->host.arch, caps->host.cpu,
|
||||||
return ret;
|
xmlDesc, failIncompatible, validateXML);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user