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

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...

Paolo



  parent reply	other threads:[~2021-09-13 13:30 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 [this message]
2021-09-13 12:56         ` Daniel P. Berrangé
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=4ae8c563-9b44-d234-eb01-a61000d01439@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@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 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.