]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't check return value of virBitmapNewCopy
authorPeter Krempa <pkrempa@redhat.com>
Fri, 2 Oct 2020 08:34:53 +0000 (10:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 5 Oct 2020 13:50:45 +0000 (15:50 +0200)
The function will not fail any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/capabilities.c
src/conf/domain_conf.c
src/conf/numa_conf.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_migration_cookie.c
src/qemu/qemu_process.c
src/test/test_driver.c
src/util/virstoragefile.c

index 4a85c6362872c2b1ca06d0518dc79840a35e6eb8..da2633761d952a9fbe89015b204de3237b1f5878 100644 (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) {
index 2fbfd949fd3e34986ad4095b805e52331fd3ae72..f716338efdf3f7668c4806b75768aba6cf7ac781 100644 (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);
index b5ddf2c134c34b59755ef524a03ae5fc10916d83..6653ba05a6b97c0cefa65546b5d1130bcdd723aa 100644 (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;
     }
index c23dca997067f9a439e0a0aa496db968ca05804d..542eabf05d66315ed1003443e467051893a96f03 100644 (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;
index 86ccb9bac407d30429b44f2634f5e3187d609534..82845736b1b917bfd9e263d10fbe67e7400545e9 100644 (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) {
index 4b73a98f7eb70af25afe0f8ef2debb155ebc611d..afbb3526e97b8612fc1d85755c1a79cc4e710a91 100644 (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;
index 8814e61314e70466c37cbb5f888dc4eee27f7865..8d28d676921871d2c4cec09ebf4d311a6bf8c380 100644 (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)
index af8fd0330828fd9ea12c499f4a6112d0cfbdc802..7824e44ed9f9ed08bf81cd8ab3ee1f3b77d7e852 100644 (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:
index a669b4ca9947533ebf68696d307d660e5288c57e..459a7be5e4e51b13690cd636f7fc515ada7d6c2b 100644 (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)))