The function now can't fail. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 3 --- tests/qemucapabilitiestest.c | 3 +-- tests/testutilsqemu.c | 10 ++-------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aba52cc10d..e7f7a6af4c 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6055,9 +6055,6 @@ virQEMUCapsCacheLookupCopy(virFileCache *cache, ret = virQEMUCapsNewCopy(qemuCaps); virObjectUnref(qemuCaps); - if (!ret) - return NULL; - virQEMUCapsFilterByMachineType(ret, virtType, machineType); return ret; } diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 58beeb48cb..5be37a8380 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -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; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 672316c848..b78634a436 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -514,9 +514,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); } @@ -538,9 +536,6 @@ qemuTestCapsCacheInsertImpl(virFileCache *cache, else tmp = virQEMUCapsNew(); - if (!tmp) - return -1; - qemuTestCapsPopulateFakeMachines(tmp, i, hostOS); if (qemuTestCapsCacheInsertData(cache, qemu_emulators[i], tmp) < 0) @@ -988,8 +983,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; -- 2.39.2