diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-05-19 14:10:00 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-05-19 14:10:01 +0100 |
commit | c5fa6c86d0765f837515d1c10654c621724a77e0 (patch) | |
tree | f7d52e821b4983ef18a57dce08c7b7c6cf97f115 /hw | |
parent | 5bc8f026dd5eb76c89395933d38dc5b0cebf5763 (diff) | |
parent | 24fd848950b44de7e2d71fb69ba52b90d6acb220 (diff) |
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp:
qapi: skip redundant includes
monitor: Add netdev_del id argument completion.
monitor: Add netdev_add type argument completion.
monitor: Add set_link arguments completion.
monitor: Add chardev-add backend argument completion.
monitor: Add chardev-remove command completion.
monitor: Convert sendkey to use command_completion.
qapi: Show qapi-commands.py invocation in qapi-code-gen.txt
qapi: Replace uncommon use of the error API by the common one
tests: Don't call visit_end_struct() after visit_start_struct() fails
hw: Don't call visit_end_struct() after visit_start_struct() fails
hmp: Call visit_end_struct() after visit_start_struct() succeeds
qapi: Un-inline visit of implicit struct
qapi-visit.py: Clean up a sloppy use of field prefix
qapi: Clean up shadowing of parameters and locals in inner scopes
qapi-visit.py: Clean up confusing push_indent() / pop_indent() use
qapi: Replace start_optional()/end_optional() by optional()
qapi: Remove unused Visitor callbacks start_handle(), end_handle()
qapi: Normalize marshalling's visitor initialization and cleanup
qapi: Update qapi-code-gen.txt example to match current code
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/timer/mc146818rtc.c | 41 | ||||
-rw-r--r-- | hw/virtio/virtio-balloon.c | 33 |
2 files changed, 59 insertions, 15 deletions
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 8509309fa7..df54546562 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -793,19 +793,46 @@ static const MemoryRegionOps cmos_ops = { static void rtc_get_date(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { + Error *err = NULL; RTCState *s = MC146818_RTC(obj); struct tm current_tm; rtc_update_time(s); rtc_get_time(s, ¤t_tm); - visit_start_struct(v, NULL, "struct tm", name, 0, errp); - visit_type_int32(v, ¤t_tm.tm_year, "tm_year", errp); - visit_type_int32(v, ¤t_tm.tm_mon, "tm_mon", errp); - visit_type_int32(v, ¤t_tm.tm_mday, "tm_mday", errp); - visit_type_int32(v, ¤t_tm.tm_hour, "tm_hour", errp); - visit_type_int32(v, ¤t_tm.tm_min, "tm_min", errp); - visit_type_int32(v, ¤t_tm.tm_sec, "tm_sec", errp); + visit_start_struct(v, NULL, "struct tm", name, 0, &err); + if (err) { + goto out; + } + visit_type_int32(v, ¤t_tm.tm_year, "tm_year", &err); + if (err) { + goto out_end; + } + visit_type_int32(v, ¤t_tm.tm_mon, "tm_mon", &err); + if (err) { + goto out_end; + } + visit_type_int32(v, ¤t_tm.tm_mday, "tm_mday", &err); + if (err) { + goto out_end; + } + visit_type_int32(v, ¤t_tm.tm_hour, "tm_hour", &err); + if (err) { + goto out_end; + } + visit_type_int32(v, ¤t_tm.tm_min, "tm_min", &err); + if (err) { + goto out_end; + } + visit_type_int32(v, ¤t_tm.tm_sec, "tm_sec", &err); + if (err) { + goto out_end; + } +out_end: + error_propagate(errp, err); + err = NULL; visit_end_struct(v, errp); +out: + error_propagate(errp, err); } static void rtc_realizefn(DeviceState *dev, Error **errp) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 971a921777..bf2b588b24 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -108,6 +108,7 @@ static void balloon_stats_poll_cb(void *opaque) static void balloon_stats_get_all(Object *obj, struct Visitor *v, void *opaque, const char *name, Error **errp) { + Error *err = NULL; VirtIOBalloon *s = opaque; int i; @@ -116,17 +117,33 @@ static void balloon_stats_get_all(Object *obj, struct Visitor *v, return; } - visit_start_struct(v, NULL, "guest-stats", name, 0, errp); - visit_type_int(v, &s->stats_last_update, "last-update", errp); + visit_start_struct(v, NULL, "guest-stats", name, 0, &err); + if (err) { + goto out; + } + visit_type_int(v, &s->stats_last_update, "last-update", &err); + if (err) { + goto out_end; + } - visit_start_struct(v, NULL, NULL, "stats", 0, errp); - for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) { + visit_start_struct(v, NULL, NULL, "stats", 0, &err); + 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], - errp); + &err); } - visit_end_struct(v, errp); - - visit_end_struct(v, errp); + error_propagate(errp, err); + err = NULL; + visit_end_struct(v, &err); + +out_end: + error_propagate(errp, err); + err = NULL; + visit_end_struct(v, &err); +out: + error_propagate(errp, err); } static void balloon_stats_get_poll_interval(Object *obj, struct Visitor *v, |