aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-03-25 13:15:14 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2013-03-26 09:27:02 -0500
commite769bdc26ded6d7681cddd9f67c5f87a4b5ba53c (patch)
tree37ad07aff485c8e7c3df43b381351a16276fa035 /hw/qdev.c
parent54852b03711f06c5f24af72de583346922176947 (diff)
hw/qdev: Abort rather than ignoring errors adding device properties
Instead of ignoring any errors that occur when adding properties to a new device in device_initfn(), check for them and abort if any occur. The most likely cause is accidentally adding a duplicate property, which is a programming error by the device author. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1364217314-7400-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 04ec4565b3..6b1947ebe1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -710,6 +710,7 @@ static void device_initfn(Object *obj)
DeviceState *dev = DEVICE(obj);
ObjectClass *class;
Property *prop;
+ Error *err = NULL;
if (qdev_hotplug) {
dev->hotplugged = 1;
@@ -725,15 +726,18 @@ static void device_initfn(Object *obj)
class = object_get_class(OBJECT(dev));
do {
for (prop = DEVICE_CLASS(class)->props; prop && prop->name; prop++) {
- qdev_property_add_legacy(dev, prop, NULL);
- qdev_property_add_static(dev, prop, NULL);
+ qdev_property_add_legacy(dev, prop, &err);
+ assert_no_error(err);
+ qdev_property_add_static(dev, prop, &err);
+ assert_no_error(err);
}
class = object_class_get_parent(class);
} while (class != object_class_by_name(TYPE_DEVICE));
qdev_prop_set_globals(dev);
object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS,
- (Object **)&dev->parent_bus, NULL);
+ (Object **)&dev->parent_bus, &err);
+ assert_no_error(err);
}
/* Unlink device from bus and free the structure. */