All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net,
	chao.p.peng@intel.com, Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH 2/2] qom/object_interfaces: Remove local_err in user_creatable_add_type
Date: Thu, 29 Feb 2024 11:37:39 +0800	[thread overview]
Message-ID: <20240229033739.1123076-3-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20240229033739.1123076-1-zhenzhong.duan@intel.com>

In user_creatable_add_type, there is mixed usage of ERRP_GUARD and
local_err. This makes error_abort not taking effect in those callee
functions with local_err passed.

Now that we already has ERRP_GUARD, remove local_err and use *errp
instead.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 qom/object_interfaces.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 255a7bf659..165cd433e7 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -81,7 +81,6 @@ Object *user_creatable_add_type(const char *type, const char *id,
     ERRP_GUARD();
     Object *obj;
     ObjectClass *klass;
-    Error *local_err = NULL;
 
     if (id != NULL && !id_wellformed(id)) {
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
@@ -109,20 +108,20 @@ Object *user_creatable_add_type(const char *type, const char *id,
 
     assert(qdict);
     obj = object_new(type);
-    object_set_properties_from_qdict(obj, qdict, v, &local_err);
-    if (local_err) {
+    object_set_properties_from_qdict(obj, qdict, v, errp);
+    if (*errp) {
         goto out;
     }
 
     if (id != NULL) {
         object_property_try_add_child(object_get_objects_root(),
-                                      id, obj, &local_err);
-        if (local_err) {
+                                      id, obj, errp);
+        if (*errp) {
             goto out;
         }
     }
 
-    if (!user_creatable_complete(USER_CREATABLE(obj), &local_err)) {
+    if (!user_creatable_complete(USER_CREATABLE(obj), errp)) {
         if (id != NULL) {
             object_property_del(object_get_objects_root(), id);
         }
@@ -130,7 +129,6 @@ Object *user_creatable_add_type(const char *type, const char *id,
     }
     return obj;
 out:
-    error_propagate(errp, local_err);
     object_unref(obj);
     return NULL;
 }
-- 
2.34.1



  parent reply	other threads:[~2024-02-29  3:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29  3:37 [PATCH 0/2] Optimize user_creatable_add_type error path Zhenzhong Duan
2024-02-29  3:37 ` [PATCH 1/2] qom/object_interfaces: Remove unnecessary local_err check Zhenzhong Duan
2024-03-15  8:20   ` Zhao Liu
2024-03-15  9:27     ` Duan, Zhenzhong
2024-02-29  3:37 ` Zhenzhong Duan [this message]
2024-03-15  8:30   ` [PATCH 2/2] qom/object_interfaces: Remove local_err in user_creatable_add_type Zhao Liu
2024-03-15  9:29     ` Duan, Zhenzhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240229033739.1123076-3-zhenzhong.duan@intel.com \
    --to=zhenzhong.duan@intel.com \
    --cc=berrange@redhat.com \
    --cc=chao.p.peng@intel.com \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.