aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:06:04 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commit992861fb1e4cf410f30ec8f05bd2dc2a14a5a027 (patch)
tree9d4d5de47d4ebae50838cd7f8ea39b89a3604507 /qom/object.c
parentaf175e85f92c870386ad74f466e29537b79611d3 (diff)
downloadqemu-992861fb1e4cf410f30ec8f05bd2dc2a14a5a027.zip
qemu-992861fb1e4cf410f30ec8f05bd2dc2a14a5a027.tar.gz
qemu-992861fb1e4cf410f30ec8f05bd2dc2a14a5a027.tar.bz2
error: Eliminate error_propagate() manually
When all we do with an Error we receive into a local variable is propagating to somewhere else, we can just as well receive it there right away. The previous two commits did that for sufficiently simple cases with Coccinelle. Do it for several more manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200707160613.848843-37-armbru@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/qom/object.c b/qom/object.c
index 37e4bc4..4c91de8 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -549,7 +549,6 @@ bool object_initialize_child_with_propsv(Object *parentobj,
const char *type,
Error **errp, va_list vargs)
{
- Error *local_err = NULL;
bool ok = false;
Object *obj;
UserCreatable *uc;
@@ -565,7 +564,7 @@ bool object_initialize_child_with_propsv(Object *parentobj,
uc = (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
if (uc) {
- if (!user_creatable_complete(uc, &local_err)) {
+ if (!user_creatable_complete(uc, errp)) {
object_unparent(obj);
goto out;
}
@@ -583,8 +582,6 @@ out:
* the reference taken by object_property_add_child().
*/
object_unref(obj);
-
- error_propagate(errp, local_err);
return ok;
}
@@ -737,7 +734,6 @@ Object *object_new_with_propv(const char *typename,
{
Object *obj;
ObjectClass *klass;
- Error *local_err = NULL;
UserCreatable *uc;
klass = object_class_by_name(typename);
@@ -762,7 +758,7 @@ Object *object_new_with_propv(const char *typename,
uc = (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE);
if (uc) {
- if (!user_creatable_complete(uc, &local_err)) {
+ if (!user_creatable_complete(uc, errp)) {
if (id != NULL) {
object_unparent(obj);
}
@@ -774,7 +770,6 @@ Object *object_new_with_propv(const char *typename,
return obj;
error:
- error_propagate(errp, local_err);
object_unref(obj);
return NULL;
}
@@ -2326,36 +2321,34 @@ static void property_get_tm(Object *obj, Visitor *v, const char *name,
prop->get(obj, &value, &err);
if (err) {
- goto out;
+ error_propagate(errp, err);
+ return;
}
- if (!visit_start_struct(v, name, NULL, 0, &err)) {
- goto out;
+ if (!visit_start_struct(v, name, NULL, 0, errp)) {
+ return;
}
- if (!visit_type_int32(v, "tm_year", &value.tm_year, &err)) {
+ if (!visit_type_int32(v, "tm_year", &value.tm_year, errp)) {
goto out_end;
}
- if (!visit_type_int32(v, "tm_mon", &value.tm_mon, &err)) {
+ if (!visit_type_int32(v, "tm_mon", &value.tm_mon, errp)) {
goto out_end;
}
- if (!visit_type_int32(v, "tm_mday", &value.tm_mday, &err)) {
+ if (!visit_type_int32(v, "tm_mday", &value.tm_mday, errp)) {
goto out_end;
}
- if (!visit_type_int32(v, "tm_hour", &value.tm_hour, &err)) {
+ if (!visit_type_int32(v, "tm_hour", &value.tm_hour, errp)) {
goto out_end;
}
- if (!visit_type_int32(v, "tm_min", &value.tm_min, &err)) {
+ if (!visit_type_int32(v, "tm_min", &value.tm_min, errp)) {
goto out_end;
}
- if (!visit_type_int32(v, "tm_sec", &value.tm_sec, &err)) {
+ if (!visit_type_int32(v, "tm_sec", &value.tm_sec, errp)) {
goto out_end;
}
- visit_check_struct(v, &err);
+ visit_check_struct(v, errp);
out_end:
visit_end_struct(v, NULL);
-out:
- error_propagate(errp, err);
-
}
static void property_release_tm(Object *obj, const char *name,