diff options
Diffstat (limited to 'hw/timer/mc146818rtc.c')
-rw-r--r-- | hw/timer/mc146818rtc.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 8509309fa7..6c3e3b6d75 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -793,19 +793,26 @@ 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_end_struct(v, 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); + visit_type_int32(v, ¤t_tm.tm_mon, "tm_mon", &err); + visit_type_int32(v, ¤t_tm.tm_mday, "tm_mday", &err); + visit_type_int32(v, ¤t_tm.tm_hour, "tm_hour", &err); + visit_type_int32(v, ¤t_tm.tm_min, "tm_min", &err); + visit_type_int32(v, ¤t_tm.tm_sec, "tm_sec", &err); + visit_end_struct(v, &err); + +out: + error_propagate(errp, err); } static void rtc_realizefn(DeviceState *dev, Error **errp) |