Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 43 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bd6beb0e52..262f4d0594 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3429,7 +3429,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
useHugepage = false;
} else if (useHugepage && pagesize == 0) {
if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
- goto cleanup;
+ return -1;
}
if (!(props = virJSONValueNewObject()))
@@ -3441,70 +3441,70 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
if (useHugepage &&
(virJSONValueObjectAdd(props, "b:hugetlb", useHugepage, NULL) <
0 ||
virJSONValueObjectAdd(props, "U:hugetlbsize", pagesize <<
10, NULL) < 0)) {
- goto cleanup;
+ return -1;
}
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
- goto cleanup;
+ return -1;
} else if (useHugepage || mem->nvdimmPath || memAccess ||
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (mem->nvdimmPath) {
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
- goto cleanup;
+ return -1;
if (!priv->memPrealloc)
prealloc = true;
} else if (useHugepage) {
if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
- goto cleanup;
+ return -1;
if (!priv->memPrealloc)
prealloc = true;
} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
if (qemuGetMemoryBackingPath(def, cfg, mem->info.alias, &memPath) <
0)
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAdd(props,
"B:prealloc", prealloc,
"s:mem-path", memPath,
NULL) < 0)
- goto cleanup;
+ return -1;
if (!mem->nvdimmPath &&
discard == VIR_TRISTATE_BOOL_YES) {
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD))
{
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this QEMU doesn't support memory
discard"));
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAdd(props,
"B:discard-data", true,
NULL) < 0)
- goto cleanup;
+ return -1;
}
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
- goto cleanup;
+ return -1;
} else {
backendType = "memory-backend-ram";
}
if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) <
0)
- goto cleanup;
+ return -1;
if (mem->alignsize) {
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("nvdimm align property is not available "
"with this QEMU binary"));
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAdd(props, "U:align", mem->alignsize * 1024,
NULL) < 0)
- goto cleanup;
+ return -1;
}
if (mem->nvdimmPmem) {
@@ -3512,10 +3512,10 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("nvdimm pmem property is not available "
"with this QEMU binary"));
- goto cleanup;
+ return -1;
}
if (virJSONValueObjectAdd(props, "s:pmem", "on", NULL) <
0)
- goto cleanup;
+ return -1;
}
if (mem->sourceNodes) {
@@ -3523,17 +3523,17 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
} else {
if (virDomainNumatuneMaybeGetNodeset(def->numa, priv->autoNodeset,
&nodemask, mem->targetNode) < 0)
- goto cleanup;
+ return -1;
}
if (nodemask) {
if (!virNumaNodesetIsAvailable(nodemask))
- goto cleanup;
+ return -1;
if (virJSONValueObjectAdd(props,
"m:host-nodes", nodemask,
"S:policy",
qemuNumaPolicyTypeToString(mode),
NULL) < 0)
- goto cleanup;
+ return -1;
}
/* If none of the following is requested... */
@@ -3553,19 +3553,19 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this qemu doesn't support the "
"memory-backend-file object"));
- goto cleanup;
+ return -1;
} else if (STREQ(backendType, "memory-backend-ram") &&
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this qemu doesn't support the "
"memory-backend-ram object"));
- goto cleanup;
+ return -1;
} else if (STREQ(backendType, "memory-backend-memory") &&
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("this qemu doesn't support the "
"memory-backend-memfd object"));
- goto cleanup;
+ return -1;
}
ret = 0;
@@ -3575,7 +3575,6 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
&props)))
ret = -1;
- cleanup:
return ret;
}
--
2.19.2