Removed code is unreacheble, since the following functions always return 0: virCPUx86DataAdd() libxlCapsAddCPUID() virCapabilitiesAddHostFeature() libxl_get_physinfo() virCapabilitiesSetNetPrefix() libxlMakeDomainOSCaps() libxlMakeDomainDeviceDiskCaps() libxlMakeDomainDeviceGraphicsCaps() libxlMakeDomainDeviceVideoCaps() Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov <frolov@xxxxxxxxx> --- src/libxl/libxl_capabilities.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 177e8b988e..68908874fb 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -64,12 +64,7 @@ libxlCapsAddCPUID(virCPUData *data, virCPUx86CPUID *cpuid, ssize_t ncaps) item.type = VIR_CPU_X86_DATA_CPUID; for (i = 0; i < ncaps; i++) { item.data.cpuid = cpuid[i]; - - if (virCPUx86DataAdd(data, &item) < 0) { - VIR_DEBUG("Failed to add CPUID(%x,%x)", - cpuid[i].eax_in, cpuid[i].ecx_in); - return -1; - } + virCPUx86DataAdd(data, &item) < 0); } return 0; @@ -119,8 +114,7 @@ libxlCapsNodeData(virCPUDef *cpu, libxl_hwcap hwcap) return NULL; ncaps = G_N_ELEMENTS(cpuid); - if (libxlCapsAddCPUID(cpudata, cpuid, ncaps) < 0) - return NULL; + libxlCapsAddCPUID(cpudata, cpuid, ncaps); return g_steal_pointer(&cpudata); } @@ -145,9 +139,10 @@ libxlCapsInitCPU(virCaps *caps, libxl_physinfo *phy_info) cpu = virCPUDefNew(); host_pae = phy_info->hw_cap[0] & LIBXL_X86_FEATURE_PAE_MASK; - if (host_pae && - virCapabilitiesAddHostFeature(caps, "pae") < 0) + if (host_pae) { + virCapabilitiesAddHostFeature(caps, "pae"); return -1; + } host_lm = (phy_info->hw_cap[2] & LIBXL_X86_FEATURE_LM_MASK); if (host_lm) @@ -179,17 +174,12 @@ libxlCapsInitHost(libxl_ctx *ctx, virCaps *caps) int ret = -1; libxl_physinfo_init(&phy_info); - if (libxl_get_physinfo(ctx, &phy_info) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to get node physical info from libxenlight")); - goto cleanup; - } + libxl_get_physinfo(ctx, &phy_info); if (libxlCapsInitCPU(caps, &phy_info) < 0) goto cleanup; - if (virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN) < 0) - goto cleanup; + virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN); ret = 0; @@ -685,11 +675,11 @@ libxlMakeDomainCapabilities(virDomainCaps *domCaps, else domCaps->maxvcpus = PV_MAX_VCPUS; - if (libxlMakeDomainOSCaps(domCaps->machine, os, firmwares, nfirmwares) < 0 || - libxlMakeDomainDeviceDiskCaps(disk) < 0 || - libxlMakeDomainDeviceGraphicsCaps(graphics) < 0 || - libxlMakeDomainDeviceVideoCaps(video) < 0) - return -1; + libxlMakeDomainOSCaps(domCaps->machine, os, firmwares, nfirmwares); + libxlMakeDomainDeviceDiskCaps(disk); + libxlMakeDomainDeviceGraphicsCaps(graphics); + libxlMakeDomainDeviceVideoCaps(video); + if (STRNEQ(domCaps->machine, "xenpvh") && libxlMakeDomainDeviceHostdevCaps(hostdev) < 0) return -1; -- 2.34.1 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx