Blob Blame History Raw
From d5bc155a97d1938e0e19f6040ae76cdd0a92ed62 Mon Sep 17 00:00:00 2001
Message-Id: <d5bc155a97d1938e0e19f6040ae76cdd0a92ed62@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 16 Mar 2020 22:11:34 +0100
Subject: [PATCH] qemuAgentFSInfoFormatParams: Remove pointless returned value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The only caller doesn't check the value and also there are no real
errors to report anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit da1b1932271ee135537b2809e87dc621748d4630)

https://bugzilla.redhat.com/show_bug.cgi?id=1812965
Message-Id: <04feacc921ce5c6f0333a4c4af7ccef8b22db6a1.1584391726.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_driver.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 26f100177b..8c7e90531a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -22996,24 +22996,20 @@ qemuDomainGetGuestInfoCheckSupport(unsigned int *types)
     *types = *types & supportedGuestInfoTypes;
 }
 
-/* Returns: 0 on success
- *          -1 otherwise
- */
-static int
+static void
 qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
                             int nfs,
                             virDomainDefPtr vmdef,
                             virTypedParameterPtr *params,
                             int *nparams, int *maxparams)
 {
-    int ret = -1;
     size_t i, j;
 
     /* FIXME: get disk target */
 
     if (virTypedParamsAddUInt(params, nparams, maxparams,
                               "fs.count", nfs) < 0)
-        goto cleanup;
+        return;
 
     for (i = 0; i < nfs; i++) {
         char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
@@ -23021,17 +23017,17 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
                    "fs.%zu.name", i);
         if (virTypedParamsAddString(params, nparams, maxparams,
                                     param_name, fsinfo[i]->name) < 0)
-            goto cleanup;
+            return;
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
                    "fs.%zu.mountpoint", i);
         if (virTypedParamsAddString(params, nparams, maxparams,
                                     param_name, fsinfo[i]->mountpoint) < 0)
-            goto cleanup;
+            return;
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
                    "fs.%zu.fstype", i);
         if (virTypedParamsAddString(params, nparams, maxparams,
                                     param_name, fsinfo[i]->fstype) < 0)
-            goto cleanup;
+            return;
 
         /* disk usage values are not returned by older guest agents, so
          * only add the params if the value is set */
@@ -23040,20 +23036,20 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
         if (fsinfo[i]->total_bytes != -1 &&
             virTypedParamsAddULLong(params, nparams, maxparams,
                                     param_name, fsinfo[i]->total_bytes) < 0)
-            goto cleanup;
+            return;
 
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
                    "fs.%zu.used-bytes", i);
         if (fsinfo[i]->used_bytes != -1 &&
             virTypedParamsAddULLong(params, nparams, maxparams,
                                     param_name, fsinfo[i]->used_bytes) < 0)
-            goto cleanup;
+            return;
 
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
                    "fs.%zu.disk.count", i);
         if (virTypedParamsAddUInt(params, nparams, maxparams,
                                   param_name, fsinfo[i]->ndisks) < 0)
-            goto cleanup;
+            return;
         for (j = 0; j < fsinfo[i]->ndisks; j++) {
             virDomainDiskDefPtr diskdef = NULL;
             qemuAgentDiskInfoPtr d = fsinfo[i]->disks[j];
@@ -23069,7 +23065,7 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
                 if (diskdef->dst &&
                     virTypedParamsAddString(params, nparams, maxparams,
                                             param_name, diskdef->dst) < 0)
-                    goto cleanup;
+                    return;
             }
 
             g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
@@ -23077,22 +23073,19 @@ qemuAgentFSInfoFormatParams(qemuAgentFSInfoPtr *fsinfo,
             if (d->serial &&
                 virTypedParamsAddString(params, nparams, maxparams,
                                         param_name, d->serial) < 0)
-                goto cleanup;
+                return;
 
             g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
                        "fs.%zu.disk.%zu.device", i, j);
             if (d->devnode &&
                 virTypedParamsAddString(params, nparams, maxparams,
                                         param_name, d->devnode) < 0)
-                goto cleanup;
+                return;
         }
     }
-    ret = nfs;
-
- cleanup:
-    return ret;
 }
 
+
 static int
 qemuDomainGetGuestInfo(virDomainPtr dom,
                        unsigned int types,
-- 
2.25.1