[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/3] qom/object_interfaces: Remove unnecessary local error che
From: |
Zhenzhong Duan |
Subject: |
[PATCH v2 1/3] qom/object_interfaces: Remove unnecessary local error check |
Date: |
Mon, 18 Mar 2024 11:32:08 +0800 |
The original error handling code indicates "local_err is always set",
and error_propagate() can handle the case that local_err is NULL.
Use err label instead of out label for error path.
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
qom/object_interfaces.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index e0833c8bfe..70179877f1 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -111,14 +111,14 @@ Object *user_creatable_add_type(const char *type, const
char *id,
obj = object_new(type);
object_set_properties_from_qdict(obj, qdict, v, &local_err);
if (local_err) {
- goto out;
+ goto err;
}
if (id != NULL) {
object_property_try_add_child(object_get_objects_root(),
id, obj, &local_err);
if (local_err) {
- goto out;
+ goto err;
}
}
@@ -126,15 +126,13 @@ Object *user_creatable_add_type(const char *type, const
char *id,
if (id != NULL) {
object_property_del(object_get_objects_root(), id);
}
- goto out;
- }
-out:
- if (local_err) {
- error_propagate(errp, local_err);
- object_unref(obj);
- return NULL;
+ goto err;
}
return obj;
+err:
+ error_propagate(errp, local_err);
+ object_unref(obj);
+ return NULL;
}
void user_creatable_add_qapi(ObjectOptions *options, Error **errp)
--
2.34.1