]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Remove return value checks from calls to virQEMUCapsNewCopy
authorPeter Krempa <pkrempa@redhat.com>
Fri, 3 Mar 2023 09:38:50 +0000 (10:38 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 6 Mar 2023 19:55:50 +0000 (20:55 +0100)
The function now can't fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c
tests/qemucapabilitiestest.c
tests/testutilsqemu.c

index 9907d8055523113bd9738f637a2298251fa940e0..8788996f21fb2ecce3e4067615311997c54497e8 100644 (file)
@@ -6074,9 +6074,6 @@ virQEMUCapsCacheLookupCopy(virFileCache *cache,
     ret = virQEMUCapsNewCopy(qemuCaps);
     virObjectUnref(qemuCaps);
 
-    if (!ret)
-        return NULL;
-
     virQEMUCapsFilterByMachineType(ret, virtType, machineType);
     return ret;
 }
index 58beeb48cbb3d147f2d00e60e9be0af1cb4ca17c..5be37a838055d78ec3595f3abdc5c710b0e1a099 100644 (file)
@@ -150,8 +150,7 @@ testQemuCapsCopy(const void *opaque)
               virArchFromString(data->archName), capsFile)))
         return -1;
 
-    if (!(copy = virQEMUCapsNewCopy(orig)))
-        return -1;
+    copy = virQEMUCapsNewCopy(orig);
 
     if (!(actual = virQEMUCapsFormatCache(copy)))
         return -1;
index 672cef9f95501e24d3f93b1b690f88bd0ee97262..d88b21b9878ff8e4b29f375aa73271afebf0bf32 100644 (file)
@@ -517,9 +517,7 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache,
             if (qemu_emulators[arch]) {
                 /* if we are dealing with fake caps we need to populate machine types */
                 if (!virQEMUCapsHasMachines(caps)) {
-                    if (!(copyCaps = effCaps = virQEMUCapsNewCopy(caps)))
-                        return -1;
-
+                    copyCaps = effCaps = virQEMUCapsNewCopy(caps);
                     qemuTestCapsPopulateFakeMachines(copyCaps, arch, hostOS);
                 }
 
@@ -541,9 +539,6 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache,
             else
                 tmp = virQEMUCapsNew();
 
-            if (!tmp)
-                return -1;
-
             qemuTestCapsPopulateFakeMachines(tmp, i, hostOS);
 
             if (qemuTestCapsCacheInsertData(cache, qemu_emulators[i], tmp) < 0)
@@ -1040,8 +1035,7 @@ testQemuInfoInitArgs(struct testQemuInfo *info)
             g_hash_table_insert(info->conf->capscache, g_strdup(capsfile), cachedcaps);
         }
 
-        if (!(info->qemuCaps = virQEMUCapsNewCopy(cachedcaps)))
-            return -1;
+        info->qemuCaps = virQEMUCapsNewCopy(cachedcaps);
 
         if (info->args.fakeCapsUsed) {
             size_t i;