diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2015-09-19 15:59:52 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2015-09-19 15:59:52 +0100 |
| commit | 18640989a9f5e4d2e84b566c52ff1fccfa0dbf4a (patch) | |
| tree | ce530f23d339d9c907cf50aeb02a3413b026b9c4 /qom/object.c | |
| parent | b12a84ce3c27e42c8f51c436aa196938d5cc2c71 (diff) | |
| parent | 3b53e45f43825caaaf4fad6a5b85ce6a9949ff02 (diff) | |
| download | focaccia-qemu-18640989a9f5e4d2e84b566c52ff1fccfa0dbf4a.tar.gz focaccia-qemu-18640989a9f5e4d2e84b566c52ff1fccfa0dbf4a.zip | |
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' into staging
QOM infrastructure fixes and device conversions * QOM API error handling fixes * Performance improvements for device GPIO property creation * Remaining conversion of QEMUMachine to QOM # gpg: Signature made Sat 19 Sep 2015 15:40:44 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: (21 commits) machine: Eliminate QEMUMachine and qemu_register_machine() Revert use of DEFINE_MACHINE() for registrations of multiple machines Use DEFINE_MACHINE() to register all machines mac_world: Break long line machine: DEFINE_MACHINE() macro exynos4: Declare each QEMUMachine as a separate variable exynos4: Use MachineClass instead of exynos4_machines array exynos4: Use EXYNOS4210_NCPUS instead of max_cpus on error message machine: Set MachineClass::name automatically machine: Ensure all TYPE_MACHINE subclasses have the right suffix mac99: Use MACHINE_TYPE_NAME to encode class name s390: Rename s390-ccw-virtio-2.4 class name to use MACHINE_TYPE_NAME s390-virtio: Rename machine class name to use MACHINE_TYPE_NAME pseries: Rename machine class names to use MACHINE_TYPE_NAME arm: Rename virt machine class to use MACHINE_TYPE_NAME vexpress: Rename machine classes to use MACHINE_TYPE_NAME vexpress: Don't set name on abstract class machine: MACHINE_TYPE_NAME macro qdev: Do not use slow [*] expansion for GPIO creation qom: Fix invalid error check in property_get_str() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qom/object.c')
| -rw-r--r-- | qom/object.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/qom/object.c b/qom/object.c index b7b05d3ffb..48053281ef 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1098,6 +1098,7 @@ typedef struct EnumProperty { int object_property_get_enum(Object *obj, const char *name, const char *typename, Error **errp) { + Error *err = NULL; StringOutputVisitor *sov; StringInputVisitor *siv; char *str; @@ -1119,7 +1120,12 @@ int object_property_get_enum(Object *obj, const char *name, enumprop = prop->opaque; sov = string_output_visitor_new(false); - object_property_get(obj, string_output_get_visitor(sov), name, errp); + object_property_get(obj, string_output_get_visitor(sov), name, &err); + if (err) { + error_propagate(errp, err); + string_output_visitor_cleanup(sov); + return 0; + } str = string_output_get_string(sov); siv = string_input_visitor_new(str); string_output_visitor_cleanup(sov); @@ -1135,21 +1141,27 @@ int object_property_get_enum(Object *obj, const char *name, void object_property_get_uint16List(Object *obj, const char *name, uint16List **list, Error **errp) { + Error *err = NULL; StringOutputVisitor *ov; StringInputVisitor *iv; char *str; ov = string_output_visitor_new(false); object_property_get(obj, string_output_get_visitor(ov), - name, errp); + name, &err); + if (err) { + error_propagate(errp, err); + goto out; + } str = string_output_get_string(ov); iv = string_input_visitor_new(str); visit_type_uint16List(string_input_get_visitor(iv), list, NULL, errp); g_free(str); - string_output_visitor_cleanup(ov); string_input_visitor_cleanup(iv); +out: + string_output_visitor_cleanup(ov); } void object_property_parse(Object *obj, const char *string, @@ -1600,12 +1612,16 @@ static void property_get_str(Object *obj, Visitor *v, void *opaque, { StringProperty *prop = opaque; char *value; + Error *err = NULL; - value = prop->get(obj, errp); - if (value) { - visit_type_str(v, &value, name, errp); - g_free(value); + value = prop->get(obj, &err); + if (err) { + error_propagate(errp, err); + return; } + + visit_type_str(v, &value, name, errp); + g_free(value); } static void property_set_str(Object *obj, Visitor *v, void *opaque, @@ -1665,8 +1681,14 @@ static void property_get_bool(Object *obj, Visitor *v, void *opaque, { BoolProperty *prop = opaque; bool value; + Error *err = NULL; + + value = prop->get(obj, &err); + if (err) { + error_propagate(errp, err); + return; + } - value = prop->get(obj, errp); visit_type_bool(v, &value, name, errp); } @@ -1720,8 +1742,14 @@ static void property_get_enum(Object *obj, Visitor *v, void *opaque, { EnumProperty *prop = opaque; int value; + Error *err = NULL; + + value = prop->get(obj, &err); + if (err) { + error_propagate(errp, err); + return; + } - value = prop->get(obj, errp); visit_type_enum(v, &value, prop->strings, NULL, name, errp); } @@ -1730,8 +1758,13 @@ static void property_set_enum(Object *obj, Visitor *v, void *opaque, { EnumProperty *prop = opaque; int value; + Error *err = NULL; - visit_type_enum(v, &value, prop->strings, NULL, name, errp); + visit_type_enum(v, &value, prop->strings, NULL, name, &err); + if (err) { + error_propagate(errp, err); + return; + } prop->set(obj, value, errp); } |