The function will not fail any more.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
if (virResctrlInfoGetMemoryBandwidth(caps->host.resctrl,
bank->level, &node->control) > 0) {
node->id = bank->id;
- if (!(node->cpus = virBitmapNewCopy(bank->cpus)))
- goto cleanup;
+ node->cpus = virBitmapNewCopy(bank->cpus);
if (VIR_APPEND_ELEMENT(caps->host.memBW.nodes,
caps->host.memBW.nnodes, node) < 0) {
if (VIR_ALLOC(resctrl) < 0)
goto cleanup;
- if (!(resctrl->vcpus = virBitmapNewCopy(vcpus))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("failed to copy 'vcpus'"));
- goto cleanup;
- }
-
+ resctrl->vcpus = virBitmapNewCopy(vcpus);
resctrl->alloc = virObjectRef(alloc);
ret = g_steal_pointer(&resctrl);
if (nodeset) {
virBitmapFree(numa->memory.nodeset);
- if (!(numa->memory.nodeset = virBitmapNewCopy(nodeset)))
- return -1;
+ numa->memory.nodeset = virBitmapNewCopy(nodeset);
+
if (placement == -1)
placement = VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC;
}
goto cleanup;
}
- if (!(tmpmap = virBitmapNewCopy(cpumap)))
- goto cleanup;
+ tmpmap = virBitmapNewCopy(cpumap);
if (!(str = virBitmapFormat(cpumap)))
goto cleanup;
goto endjob;
virBitmapFree(def->cputune.emulatorpin);
- def->cputune.emulatorpin = NULL;
-
- if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
- goto endjob;
+ def->cputune.emulatorpin = virBitmapNewCopy(pcpumap);
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
goto endjob;
if (persistentDef) {
virBitmapFree(persistentDef->cputune.emulatorpin);
- persistentDef->cputune.emulatorpin = NULL;
-
- if (!(persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
- goto endjob;
+ persistentDef->cputune.emulatorpin = virBitmapNewCopy(pcpumap);
ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);
goto endjob;
ssize_t next = -1;
size_t i;
- if (!(map = virBitmapNewCopy(vcpus)))
- return NULL;
+ map = virBitmapNewCopy(vcpus);
/* make sure that all selected vcpus are in the correct state */
while ((next = virBitmapNextSetBit(map, next)) >= 0) {
mig->caps->automatic = qemuMigrationParamsGetAlwaysOnCaps(party);
- if (!mig->caps->supported || !mig->caps->automatic)
- return -1;
-
mig->flags |= QEMU_MIGRATION_COOKIE_CAPS;
return 0;
if (virNumaNodesetToCPUset(nodeset, &cpumapToSet) < 0)
return -1;
} else if (vm->def->cputune.emulatorpin) {
- if (!(cpumapToSet = virBitmapNewCopy(vm->def->cputune.emulatorpin)))
- return -1;
+ cpumapToSet = virBitmapNewCopy(vm->def->cputune.emulatorpin);
} else {
settingAll = true;
if (qemuProcessGetAllCpuAffinity(&cpumapToSet) < 0)
}
virBitmapFree(def->cputune.emulatorpin);
- def->cputune.emulatorpin = NULL;
-
- if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
- goto cleanup;
+ def->cputune.emulatorpin = virBitmapNewCopy(pcpumap);
ret = 0;
cleanup:
!(def->srcpool = virStorageSourcePoolDefCopy(src->srcpool)))
return NULL;
- if (src->features &&
- !(def->features = virBitmapNewCopy(src->features)))
- return NULL;
+ if (src->features)
+ def->features = virBitmapNewCopy(src->features);
if (src->encryption &&
!(def->encryption = virStorageEncryptionCopy(src->encryption)))