The functions were always returning 0. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/cpu_conf.c | 11 ++++------- src/conf/cpu_conf.h | 4 ++-- src/cpu/cpu_arm.c | 3 +-- src/cpu/cpu_s390.c | 3 +-- src/cpu/cpu_x86.c | 11 +++++------ src/qemu/qemu_capabilities.c | 10 ++++------ src/qemu/qemu_domain.c | 10 ++++------ src/qemu/qemu_driver.c | 9 +++------ src/qemu/qemu_process.c | 8 ++++---- 9 files changed, 28 insertions(+), 41 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index a33f39ef31..1227db1201 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -140,16 +140,16 @@ virCPUDefFree(virCPUDef *def) } -int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) +void ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) virCPUDefCopyModel(virCPUDef *dst, const virCPUDef *src, bool resetPolicy) { - return virCPUDefCopyModelFilter(dst, src, resetPolicy, NULL, NULL); + virCPUDefCopyModelFilter(dst, src, resetPolicy, NULL, NULL); } -int +void virCPUDefCopyModelFilter(virCPUDef *dst, const virCPUDef *src, bool resetPolicy, @@ -185,8 +185,6 @@ virCPUDefCopyModelFilter(virCPUDef *dst, dst->features[n].name = g_strdup(src->features[i].name); } - - return 0; } @@ -281,8 +279,7 @@ virCPUDefCopy(const virCPUDef *cpu) if (!(copy = virCPUDefCopyWithoutModel(cpu))) return NULL; - if (virCPUDefCopyModel(copy, cpu, false) < 0) - return NULL; + virCPUDefCopyModel(copy, cpu, false); return g_steal_pointer(©); } diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 113d349708..5d69b4d2e0 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -175,7 +175,7 @@ void virCPUDefFree(virCPUDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUDef, virCPUDefFree); -int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) +void ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) virCPUDefCopyModel(virCPUDef *dst, const virCPUDef *src, bool resetPolicy); @@ -187,7 +187,7 @@ typedef bool (*virCPUDefFeatureFilter)(const char *name, virCPUFeaturePolicy policy, void *opaque); -int +void virCPUDefCopyModelFilter(virCPUDef *dst, const virCPUDef *src, bool resetPolicy, diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 3ec06edef4..a890ed6ba3 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -465,8 +465,7 @@ virCPUarmUpdate(virCPUDef *guest, return -1; updated->mode = VIR_CPU_MODE_CUSTOM; - if (virCPUDefCopyModel(updated, host, true) < 0) - return -1; + virCPUDefCopyModel(updated, host, true); virCPUDefStealModel(guest, updated, false); guest->mode = VIR_CPU_MODE_CUSTOM; diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c index 81a1513ecb..0f3b5c6820 100644 --- a/src/cpu/cpu_s390.c +++ b/src/cpu/cpu_s390.c @@ -72,8 +72,7 @@ virCPUs390Update(virCPUDef *guest, return -1; updated->mode = VIR_CPU_MODE_CUSTOM; - if (virCPUDefCopyModel(updated, host, true) < 0) - return -1; + virCPUDefCopyModel(updated, host, true); for (i = 0; i < guest->nfeatures; i++) { if (virCPUDefUpdateFeature(updated, diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index c6323ce8c7..2fede8e5fa 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -2943,8 +2943,7 @@ x86UpdateHostModel(virCPUDef *guest, updated->type = VIR_CPU_TYPE_GUEST; updated->mode = VIR_CPU_MODE_CUSTOM; - if (virCPUDefCopyModel(updated, host, true) < 0) - return -1; + virCPUDefCopyModel(updated, host, true); if (guest->vendor_id) { g_free(updated->vendor_id); @@ -3257,7 +3256,9 @@ virCPUx86ExpandFeatures(virCPUDef *cpu) virCPUDefFreeModel(cpu); - return virCPUDefCopyModel(cpu, expanded, false); + virCPUDefCopyModel(cpu, expanded, false); + + return 0; } @@ -3282,9 +3283,7 @@ virCPUx86CopyMigratable(virCPUDef *cpu) if (!(copy = virCPUDefCopyWithoutModel(cpu))) return NULL; - if (virCPUDefCopyModelFilter(copy, cpu, false, - x86FeatureFilterMigratable, map) < 0) - return NULL; + virCPUDefCopyModelFilter(copy, cpu, false, x86FeatureFilterMigratable, map); return g_steal_pointer(©); } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 826293a879..9fe6579dfe 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3852,13 +3852,11 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, VIR_DEBUG("No host CPU model info from QEMU; probing host CPU directly"); cpuModels = virQEMUCapsGetCPUModels(qemuCaps, type, NULL, NULL); - hostCPU = virQEMUCapsProbeHostCPU(hostArch, cpuModels); - - if (!hostCPU || - virCPUDefCopyModelFilter(cpu, hostCPU, true, - virQEMUCapsCPUFilterFeatures, - &qemuCaps->arch) < 0) + if (!(hostCPU = virQEMUCapsProbeHostCPU(hostArch, cpuModels))) goto error; + + virCPUDefCopyModelFilter(cpu, hostCPU, true, virQEMUCapsCPUFilterFeatures, + &qemuCaps->arch); } else if (rc == 2) { VIR_DEBUG("QEMU does not provide CPU model for arch=%s virttype=%s", virArchToString(qemuCaps->arch), diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 74e20c4edb..9791fa1dca 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10781,9 +10781,8 @@ qemuDomainFixupCPUs(virDomainObj *vm, if (!fixedCPU) return -1; - if (virCPUDefCopyModelFilter(fixedCPU, vm->def->cpu, false, - virQEMUCapsCPUFilterFeatures, &arch) < 0) - return -1; + virCPUDefCopyModelFilter(fixedCPU, vm->def->cpu, false, + virQEMUCapsCPUFilterFeatures, &arch); virCPUDefFree(vm->def->cpu); vm->def->cpu = g_steal_pointer(&fixedCPU); @@ -10795,9 +10794,8 @@ qemuDomainFixupCPUs(virDomainObj *vm, if (!fixedOrig) return -1; - if (virCPUDefCopyModelFilter(fixedOrig, *origCPU, false, - virQEMUCapsCPUFilterFeatures, &arch) < 0) - return -1; + virCPUDefCopyModelFilter(fixedOrig, *origCPU, false, + virQEMUCapsCPUFilterFeatures, &arch); virCPUDefFree(*origCPU); *origCPU = g_steal_pointer(&fixedOrig); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d00eb1796f..146318c6db 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12196,10 +12196,8 @@ qemuConnectBaselineCPU(virConnectPtr conn G_GNUC_UNUSED, if (!(cpu = virCPUDefCopyWithoutModel(baseline))) goto cleanup; - if (virCPUDefCopyModelFilter(cpu, baseline, false, - virQEMUCapsCPUFilterFeatures, - &cpus[0]->arch) < 0) - goto cleanup; + virCPUDefCopyModelFilter(cpu, baseline, false, virQEMUCapsCPUFilterFeatures, + &cpus[0]->arch); if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) && virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) @@ -12295,8 +12293,7 @@ qemuConnectCPUModelBaseline(virQEMUCaps *qemuCaps, baseline = g_new0(virCPUDef, 1); - if (virCPUDefCopyModel(baseline, cpus[0], false) < 0) - return NULL; + virCPUDefCopyModel(baseline, cpus[0], false); for (i = 1; i < ncpus; i++) { if (qemuMonitorGetCPUModelBaseline(proc->mon, baseline, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 63d7e1138d..27973a2e03 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8853,12 +8853,12 @@ qemuProcessRefreshCPU(virQEMUDriver *driver, if (!(hostmig = virCPUCopyMigratable(host->arch, host))) return -1; - if (!(cpu = virCPUDefCopyWithoutModel(hostmig)) || - virCPUDefCopyModelFilter(cpu, hostmig, false, - virQEMUCapsCPUFilterFeatures, - &host->arch) < 0) + if (!(cpu = virCPUDefCopyWithoutModel(hostmig))) return -1; + virCPUDefCopyModelFilter(cpu, hostmig, false, virQEMUCapsCPUFilterFeatures, + &host->arch); + if (virCPUUpdate(vm->def->os.arch, vm->def->cpu, cpu) < 0) return -1; -- 2.39.2