Don't check return value of virBitmapNewCopy

The function will not fail any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-10-02 10:34:53 +02:00
parent 6b18cafb1d
commit faa88866f5
9 changed files with 12 additions and 34 deletions

View File

@ -1823,8 +1823,7 @@ virCapabilitiesInitResctrlMemory(virCapsPtr caps)
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) {

View File

@ -20928,12 +20928,7 @@ virDomainResctrlNew(xmlNodePtr node,
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);

View File

@ -582,8 +582,8 @@ virDomainNumatuneSet(virDomainNumaPtr numa,
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;
}

View File

@ -4543,8 +4543,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
goto cleanup;
}
if (!(tmpmap = virBitmapNewCopy(cpumap)))
goto cleanup;
tmpmap = virBitmapNewCopy(cpumap);
if (!(str = virBitmapFormat(cpumap)))
goto cleanup;
@ -4782,10 +4781,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
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;
@ -4802,10 +4798,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
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;

View File

@ -6424,8 +6424,7 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def,
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) {

View File

@ -568,9 +568,6 @@ qemuMigrationCookieAddCaps(qemuMigrationCookiePtr mig,
mig->caps->automatic = qemuMigrationParamsGetAlwaysOnCaps(party);
if (!mig->caps->supported || !mig->caps->automatic)
return -1;
mig->flags |= QEMU_MIGRATION_COOKIE_CAPS;
return 0;

View File

@ -2562,8 +2562,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
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)

View File

@ -2743,10 +2743,7 @@ testDomainPinEmulator(virDomainPtr dom,
}
virBitmapFree(def->cputune.emulatorpin);
def->cputune.emulatorpin = NULL;
if (!(def->cputune.emulatorpin = virBitmapNewCopy(pcpumap)))
goto cleanup;
def->cputune.emulatorpin = virBitmapNewCopy(pcpumap);
ret = 0;
cleanup:

View File

@ -2422,9 +2422,8 @@ virStorageSourceCopy(const virStorageSource *src,
!(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)))