Re: [PATCH 2/2] lib: Don't check for virCapabilitiesAddGuestDomain() retval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Thursday in 2021, Michal Privoznik wrote:
The virCapabilitiesAddGuestDomain() function can't fail. It
aborts on OOM. Therefore, there's no need to check for its
return value.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/bhyve/bhyve_capabilities.c |  5 ++---
src/ch/ch_conf.c               | 10 ++--------
src/esx/esx_driver.c           |  8 ++++----
src/hyperv/hyperv_driver.c     |  8 ++++----
src/libxl/libxl_capabilities.c |  9 ++-------
src/lxc/lxc_conf.c             | 18 ++++--------------
src/openvz/openvz_conf.c       |  9 ++-------
src/qemu/qemu_capabilities.c   | 20 ++++----------------
src/security/virt-aa-helper.c  | 11 ++---------
src/test/test_driver.c         |  9 ++-------
src/vbox/vbox_common.c         |  9 ++-------
src/vmware/vmware_conf.c       | 12 ++++--------
src/vz/vz_driver.c             |  4 +---
tests/testutils.c              | 29 ++++++++++++-----------------
tests/testutilslxc.c           |  8 ++------
tests/testutilsqemu.c          | 19 +++++--------------
tests/testutilsxen.c           | 15 ++++++---------
tests/vmx2xmltest.c            | 18 ++++--------------
tests/xml2vmxtest.c            | 19 ++++---------------
19 files changed, 68 insertions(+), 172 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index cc1c7b66b3..bbcdee724f 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -54,9 +54,8 @@ virBhyveCapsBuild(void)
                                    VIR_ARCH_X86_64, "bhyve",
                                    NULL, 0, NULL);

-    if (virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_BHYVE,
-                                      NULL, NULL, 0, NULL) == NULL)
-        goto error;
+    virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_BHYVE,
+                                  NULL, NULL, 0, NULL);


This removes the last usage of 'error' in this function.

    if (!(caps->host.cpu = virCPUProbeHost(caps->host.arch)))
        VIR_WARN("Failed to get host CPU");

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux