[libvirt] [PATCH v1 09/21] qemu_monitor_json.c: remove unneeded cleanup label

Daniel Henrique Barboza danielhb413 at gmail.com
Mon Oct 21 18:18:59 UTC 2019


qemuMonitorJSONBlockIoThrottleInfo uses a macro called
GET_THROTTLE_STATS that's defined outside of the function,
which references a 'cleanup' label. GET_THROTTLE_STATS is
only used inside qemuMonitorJSONBlockIoThrottleInfo (in fact,
the macro is undef right after it) thus it is safe to erase
the 'cleanup' reference inside the macro, then proceed
with the usual cleanup label removal inside
qemuMonitorJSONBlockIoThrottleInfo.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/qemu/qemu_monitor_json.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 99f55c420a..31e10c5127 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5195,7 +5195,7 @@ int qemuMonitorJSONOpenGraphics(qemuMonitorPtr mon,
                        _("block_io_throttle field '%s' missing " \
                          "in qemu's output"), \
                        #STORE); \
-        goto cleanup; \
+        return -1; \
     }
 static int
 qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
@@ -5203,7 +5203,6 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
                                    const char *qdevid,
                                    virDomainBlockIoTuneInfoPtr reply)
 {
-    int ret = -1;
     size_t i;
     bool found = false;
 
@@ -5217,7 +5216,7 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("block_io_throttle device entry "
                              "was not in expected format"));
-            goto cleanup;
+            return -1;
         }
 
         current_qdev = virJSONValueObjectGetString(temp_dev, "qdev");
@@ -5227,7 +5226,7 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("block_io_throttle device entry "
                              "was not in expected format"));
-            goto cleanup;
+            return -1;
         }
 
         if ((drivealias && current_drive && STRNEQ(current_drive, drivealias)) ||
@@ -5239,7 +5238,7 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("block_io_throttle inserted entry "
                              "was not in expected format"));
-            goto cleanup;
+            return -1;
         }
         GET_THROTTLE_STATS("bps", total_bytes_sec);
         GET_THROTTLE_STATS("bps_rd", read_bytes_sec);
@@ -5271,12 +5270,10 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("cannot find throttling info for device '%s'"),
                        drivealias ? drivealias : qdevid);
-        goto cleanup;
+        return -1;
     }
-    ret = 0;
 
- cleanup:
-    return ret;
+    return 0;
 }
 #undef GET_THROTTLE_STATS
 #undef GET_THROTTLE_STATS_OPTIONAL
-- 
2.21.0




More information about the libvir-list mailing list