All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Zhenzhong Duan <zhenzhong.duan@intel.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, berrange@redhat.com,
	eduardo@habkost.net, chao.p.peng@intel.com
Subject: Re: [PATCH 1/2] qom/object_interfaces: Remove unnecessary local_err check
Date: Fri, 15 Mar 2024 16:20:07 +0800	[thread overview]
Message-ID: <ZfQEt45kBG218Vs+@intel.com> (raw)
In-Reply-To: <20240229033739.1123076-2-zhenzhong.duan@intel.com>

On Thu, Feb 29, 2024 at 11:37:38AM +0800, Zhenzhong Duan wrote:
> Date: Thu, 29 Feb 2024 11:37:38 +0800
> From: Zhenzhong Duan <zhenzhong.duan@intel.com>
> Subject: [PATCH 1/2] qom/object_interfaces: Remove unnecessary local_err
>  check
> X-Mailer: git-send-email 2.34.1
> 
> In the error return path, local_err is always set, no need to check it.

The original error handling code indicates "local_err is always set",
and error_propagate() can handle the case that local_err is NULL.

> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
>  qom/object_interfaces.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
> index e0833c8bfe..255a7bf659 100644
> --- a/qom/object_interfaces.c
> +++ b/qom/object_interfaces.c
> @@ -128,13 +128,11 @@ Object *user_creatable_add_type(const char *type, const char *id,
>          }
>          goto out;
>      }
> -out:
> -    if (local_err) {
> -        error_propagate(errp, local_err);
> -        object_unref(obj);
> -        return NULL;
> -    }
>      return obj;
> +out:

Maybe rename this to "err:"? Since now it's just used to handle error,
and "goto err" seems more clear.

> +    error_propagate(errp, local_err);
> +    object_unref(obj);
> +    return NULL;
>  }
>  
>  void user_creatable_add_qapi(ObjectOptions *options, Error **errp)
> -- 
> 2.34.1
> 

Otherwise,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>




  reply	other threads:[~2024-03-15  8:07 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 [this message]
2024-03-15  9:27     ` Duan, Zhenzhong
2024-02-29  3:37 ` [PATCH 2/2] qom/object_interfaces: Remove local_err in user_creatable_add_type Zhenzhong Duan
2024-03-15  8:30   ` 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=ZfQEt45kBG218Vs+@intel.com \
    --to=zhao1.liu@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 \
    --cc=zhenzhong.duan@intel.com \
    /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.