[libvirt PATCH 02/14] bhyve: refactor bhyveProbeCapsDeviceHelper

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

 



Use g_auto and remove the 'ret' variable, as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/bhyve/bhyve_capabilities.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index ed0df35518..421d0622cd 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -199,24 +199,20 @@ bhyveProbeCapsDeviceHelper(unsigned int *caps,
                            const char *errormsg,
                            unsigned int flag)
 {
-    char *error;
-    virCommand *cmd = NULL;
-    int ret = -1, exit;
+    g_autofree char *error = NULL;
+    g_autoptr(virCommand) cmd = NULL;
+    int exit;
 
     cmd = virCommandNew(binary);
     virCommandAddArgList(cmd, bus, device, NULL);
     virCommandSetErrorBuffer(cmd, &error);
     if (virCommandRun(cmd, &exit) < 0)
-        goto cleanup;
+        return -1;
 
     if (strstr(error, errormsg) == NULL)
         *caps |= flag;
 
-    ret = 0;
- cleanup:
-    VIR_FREE(error);
-    virCommandFree(cmd);
-    return ret;
+    return 0;
 }
 
 static int
-- 
2.31.1




[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