qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Yang Zhong <yang.zhong@intel.com>,
	eblake@redhat.com, philmd@redhat.com, qemu-devel@nongnu.org,
	seanjc@google.com
Subject: Re: [PATCH v2 1/3] monitor: Add HMP and QMP interfaces
Date: Mon, 13 Sep 2021 13:56:13 +0100	[thread overview]
Message-ID: <YT9KbTrZv7XpvNbN@redhat.com> (raw)
In-Reply-To: <4ae8c563-9b44-d234-eb01-a61000d01439@redhat.com>

On Mon, Sep 13, 2021 at 02:48:37PM +0200, Paolo Bonzini wrote:
> On 13/09/21 11:35, Daniel P. Berrangé wrote:
> > >    g_autoptr(Error) err = NULL
> > I was mistaken here - Error shouldn't use g_autoptr, just
> > 
> >     Error err = NULL;
> > 
> > > > +    SGXInfo *info = qmp_query_sgx(NULL);
> > > Pass in &err not NULL;
> > > 
> > > Also  declare it with  'g_autoptr(SGXInfo) info = ...'
> > > 
> > > And then
> > > 
> > >     if (err) {
> > >        monitor_printf(mon, "%s\n", error_get_pretty(err);
> > Then use the simpler:
> > 
> >      error_report_err(err);
> 
> Indeed.
> 
> That said, more long term (but this is something Coccinelle could help with)
> perhaps error_report_err should not free the error, and instead we should
> use g_autoptr(Error) in the callers.  I don't like functions that do not
> have free in their name and yet free a pointer...

Yes, this error_report_err surprises me every 6 months when I
come to deal with it. So I think using g_autoptr would be a
nice replacement, with no additional burden in terms of lines
of code in callers too.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2021-09-13 13:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 10:22 [PATCH v2 0/3] The HMP/QMP interfaces in Qemu SGX Yang Zhong
2021-09-10 10:22 ` [PATCH v2 1/3] monitor: Add HMP and QMP interfaces Yang Zhong
2021-09-10 12:39   ` Philippe Mathieu-Daudé
2021-09-13 10:37     ` Yang Zhong
2021-09-13 12:42       ` Paolo Bonzini
2021-09-10 13:46   ` Daniel P. Berrangé
2021-09-13  9:35     ` Daniel P. Berrangé
2021-09-13 10:46       ` Yang Zhong
2021-09-13 12:48       ` Paolo Bonzini
2021-09-13 12:56         ` Daniel P. Berrangé [this message]
2021-09-13 12:52           ` Yang Zhong
2021-09-13 13:24             ` Daniel P. Berrangé
2021-09-16  6:14               ` Yang Zhong
2021-09-10 10:22 ` [PATCH v2 2/3] qmp: Add the qmp_query_sgx_capabilities() Yang Zhong
2021-09-10 12:41   ` Philippe Mathieu-Daudé
2021-09-13 10:34     ` Yang Zhong
2021-09-10 10:22 ` [PATCH v2 3/3] pc: Cleanup the SGX definitions Yang Zhong
2021-09-10 14:15 ` [PATCH v2 0/3] The HMP/QMP interfaces in Qemu SGX Paolo Bonzini
2021-09-10 14:21   ` Daniel P. Berrangé
2021-09-10 19:10     ` Paolo Bonzini

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=YT9KbTrZv7XpvNbN@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seanjc@google.com \
    --cc=yang.zhong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).