[PATCH 2/6] Don't check return value of virBitmapNewCopy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

     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;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 86ccb9bac4..82845736b1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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) {
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index 4b73a98f7e..afbb3526e9 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -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;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8814e61314..8d28d67692 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index af8fd03308..7824e44ed9 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -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:
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index a669b4ca99..459a7be5e4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -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)))
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux