[PATCH 05/31] virQEMUCapsInitGuestFromBinary: Refactor cleanup

Peter Krempa pkrempa at redhat.com
Thu Mar 30 13:37:59 UTC 2023


Remove useless call to virCapabilitiesFreeMachines as the pointers were
cleared and the unneeded 'ret' variable. Since we don't need to clear
the 'machines' pointer now, remove that as well.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_capabilities.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0201f288b3..135455df63 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1105,7 +1105,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps,
     virCapsGuest *guest;
     virCapsGuestMachine **machines = NULL;
     size_t nmachines = 0;
-    int ret = -1;

     if (!binary)
         return 0;
@@ -1118,9 +1117,6 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps,
                                     guestarch, binary,
                                     NULL, nmachines, machines);

-    machines = NULL;
-    nmachines = 0;
-
     /* CPU selection is always available, because all QEMU versions
      * we support can use at least '-cpu host' */
     virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_CPUSELECTION);
@@ -1155,11 +1151,7 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps,
         virCapabilitiesAddGuestFeature(guest, VIR_CAPS_GUEST_FEATURE_TYPE_NONPAE);
     }

-    ret = 0;
-
-    virCapabilitiesFreeMachines(machines, nmachines);
-
-    return ret;
+    return 0;
 }


-- 
2.39.2



More information about the libvir-list mailing list