[PATCH 2/6] Don't check return value of virBitmapNewCopy
Ján Tomko
jtomko at redhat.com
Fri Oct 2 12:23:40 UTC 2020
On a Friday in 2020, Peter Krempa wrote:
>The function will not fail any more.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> 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 at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201002/bb7473d1/attachment-0001.sig>
More information about the libvir-list
mailing list