On a Friday in 2020, Peter Krempa wrote:
The function will not fail any more. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/capabilities.c | 3 +-- src/conf/domain_conf.c | 7 +------ src/conf/numa_conf.c | 4 ++-- src/qemu/qemu_driver.c | 13 +++---------- src/qemu/qemu_hotplug.c | 3 +-- src/qemu/qemu_migration_cookie.c | 3 --- src/qemu/qemu_process.c | 3 +-- src/test/test_driver.c | 5 +---- src/util/virstoragefile.c | 5 ++--- 9 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 4a85c63628..da2633761d 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -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) { diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2fbfd949fd..f716338efd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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); diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index b5ddf2c134..6653ba05a6 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -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; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c23dca9970..542eabf05d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4543,8 +4543,7 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm, goto cleanup; } - if (!(tmpmap = virBitmapNewCopy(cpumap))) - goto cleanup; + tmpmap = virBitmapNewCopy(cpumap);
There is nothing chaning `cpumap` between here and the line where tmpmap is transferred to `vcpuinfo->cpumask`: virBitmapFree(vcpuinfo->cpumask); vcpuinfo->cpumask = tmpmap; tmpmap = NULL; But that is out of scope of this patch.
if (!(str = virBitmapFormat(cpumap))) goto cleanup;
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Jano
Attachment:
signature.asc
Description: PGP signature