From bc5c4f21966977c4ff00ae77979b95a2b39142a3 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 2 Feb 2017 12:59:54 +0000 Subject: vmstate_register_with_alias_id: Take an Error ** I'll be adding an error to it in a subsequent patch. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20170202125956.21942-2-dgilbert@redhat.com> Signed-off-by: Juan Quintela --- hw/core/qdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/core/qdev.c') diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 57834423b9..ea97b15f45 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -935,7 +935,8 @@ static void device_set_realized(Object *obj, bool value, Error **errp) if (qdev_get_vmsd(dev)) { vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev, dev->instance_id_alias, - dev->alias_required_for_version); + dev->alias_required_for_version, + NULL); } QLIST_FOREACH(bus, &dev->child_bus, sibling) { -- cgit v1.2.3 From 67980031d234aa90524b83bb80bb5d1601d29076 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 2 Feb 2017 12:59:56 +0000 Subject: vmstate registration: check return values Check qdev's call to vmstate_register_with_alias_id; that gets most of the common uses; there's hundreds of calls via vmstate_register which could get fixed over time. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20170202125956.21942-4-dgilbert@redhat.com> Signed-off-by: Juan Quintela --- hw/core/qdev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'hw/core/qdev.c') diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ea97b15f45..06ba02e2a3 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -933,10 +933,12 @@ static void device_set_realized(Object *obj, bool value, Error **errp) } if (qdev_get_vmsd(dev)) { - vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev, - dev->instance_id_alias, - dev->alias_required_for_version, - NULL); + if (vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev, + dev->instance_id_alias, + dev->alias_required_for_version, + &local_err) < 0) { + goto post_realize_fail; + } } QLIST_FOREACH(bus, &dev->child_bus, sibling) { -- cgit v1.2.3