[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 26/28] qdev-props: call object_apply_global_props
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v6 26/28] qdev-props: call object_apply_global_props() |
Date: |
Thu, 13 Dec 2018 01:48:48 +0400 |
It's now possible to use the common function.
Teach object_apply_global_props() to warn if Error argument is NULL.
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
---
hw/core/qdev-properties.c | 24 ++----------------------
qom/object.c | 12 +++++++++++-
2 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index a2d25d3d37..6061090dc2 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -1223,28 +1223,8 @@ int qdev_prop_check_globals(void)
void qdev_prop_set_globals(DeviceState *dev)
{
- int i;
-
- for (i = 0; i < global_props()->len; i++) {
- GlobalProperty *prop;
- Error *err = NULL;
-
- prop = g_ptr_array_index(global_props(), i);
- if (object_dynamic_cast(OBJECT(dev), prop->driver) == NULL) {
- continue;
- }
- prop->used = true;
- object_property_parse(OBJECT(dev), prop->value, prop->property, &err);
- if (err != NULL) {
- error_prepend(&err, "can't apply global %s.%s=%s: ",
- prop->driver, prop->property, prop->value);
- if (!dev->hotplugged) {
- error_propagate(&error_fatal, err);
- } else {
- warn_report_err(err);
- }
- }
- }
+ object_apply_global_props(OBJECT(dev), global_props(),
+ dev->hotplugged ? NULL : &error_fatal);
}
/* --- 64bit unsigned int 'size' type --- */
diff --git a/qom/object.c b/qom/object.c
index dbdab0aead..aa6f3a2a71 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -390,7 +390,17 @@ void object_apply_global_props(Object *obj, const
GPtrArray *props, Error **errp
if (err != NULL) {
error_prepend(&err, "can't apply global %s.%s=%s: ",
p->driver, p->property, p->value);
- error_propagate(errp, err);
+ /*
+ * If errp != NULL, propagate error and return.
+ * If errp == NULL, report a warning, but keep going
+ * with the remaining globals.
+ */
+ if (errp) {
+ error_propagate(errp, err);
+ return;
+ } else {
+ warn_report_err(err);
+ }
}
}
}
--
2.20.0
- [Qemu-devel] [PATCH v6 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros, (continued)
- [Qemu-devel] [PATCH v6 16/28] compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 18/28] compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 19/28] compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 17/28] compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 20/28] include: remove compat.h, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 22/28] qdev: make a separate helper function to apply compat properties, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 21/28] compat: remove remaining PC_COMPAT macros, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 23/28] qdev: all globals are now user-provided, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 24/28] qdev-props: convert global_props to GPtrArray, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 25/28] qdev-props: remove errp from GlobalProperty, Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 26/28] qdev-props: call object_apply_global_props(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH v6 27/28] arm: replace instance_post_init(), Marc-André Lureau, 2018/12/12
- [Qemu-devel] [PATCH v6 28/28] hostmem: use object id for memory region name with >= 4.0, Marc-André Lureau, 2018/12/12
- Re: [Qemu-devel] [PATCH v6 00/28] Generalize machine compatibility properties, Cornelia Huck, 2018/12/13
- Re: [Qemu-devel] [PATCH v6 00/28] Generalize machine compatibility properties, Igor Mammedov, 2018/12/20