diff mbox

[v10,09/25] balloon: Improve use of qapi visitor

Message ID 1454075341-13658-10-git-send-email-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake Jan. 29, 2016, 1:48 p.m. UTC
Rework the control flow of balloon_stats_get_all() to make it
easier for a later patch to split visit_end_struct().  Also
switch to the uint64 visitor to match the data type.

Signed-off-by: Eric Blake <eblake@redhat.com>

---
v10: defer out_nested label to later patch, drop Marc-Andre's R-b
v9: no change
v8: no change
v7: place earlier in series
v6: new patch, split from RFC on v5 7/46
---
 hw/virtio/virtio-balloon.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 9671635..ba1d393 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -130,9 +130,11 @@  static void balloon_stats_get_all(Object *obj, struct Visitor *v,
     if (err) {
         goto out_end;
     }
-    for (i = 0; !err && i < VIRTIO_BALLOON_S_NR; i++) {
-        visit_type_int64(v, (int64_t *) &s->stats[i], balloon_stat_names[i],
-                         &err);
+    for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) {
+        visit_type_uint64(v, &s->stats[i], balloon_stat_names[i], &err);
+        if (err) {
+            break;
+        }
     }
     error_propagate(errp, err);
     err = NULL;