From: Stefan Hajnoczi <stefanha@gmail.com>
To: Chrysostomos Nanakos <cnanakos@grnet.gr>
Cc: kwolf@redhat.com, pingfank@linux.vnet.ibm.com, famz@redhat.com,
benoit@irqsave.net, jan.kiszka@siemens.com, mjt@tls.msk.ru,
qemu-devel@nongnu.org, stefanha@redhat.com, sw@weilnetz.de,
pbonzini@redhat.com, kroosec@gmail.com, afaerber@suse.de,
aliguori@amazon.com
Subject: Re: [Qemu-devel] [PATCH v1] async: aio_context_new(): Handle event_notifier_init failure
Date: Tue, 16 Sep 2014 15:43:13 +0100 [thread overview]
Message-ID: <20140916144313.GD10303@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1410690193-21813-2-git-send-email-cnanakos@grnet.gr>
[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]
On Sun, Sep 14, 2014 at 01:23:13PM +0300, Chrysostomos Nanakos wrote:
> @@ -63,10 +64,19 @@ static void iothread_instance_finalize(Object *obj)
>
> static void iothread_complete(UserCreatable *obj, Error **errp)
> {
> + int ret;
> + Error *local_error = NULL;
> IOThread *iothread = IOTHREAD(obj);
>
> iothread->stopping = false;
> - iothread->ctx = aio_context_new();
> + ret = aio_context_new(&iothread->ctx, &local_error);
> + if (ret < 0) {
> + errno = -ret;
> + error_report("%s", error_get_pretty(local_error));
> + error_report("iothread_complete failed");
> + error_free(local_error);
> + exit(1);
> + }
Why use error_report()? The function takes an errp argument so
local_error should be propagated.
> @@ -2893,7 +2895,14 @@ int main(int argc, char **argv)
> error_set_progname(argv[0]);
> qemu_init_exec_dir(argv[0]);
>
> - qemu_init_main_loop();
> + ret = qemu_init_main_loop(&local_error);
> + if (ret < 0) {
> + errno = -ret;
> + error_report("%s", error_get_pretty(local_error));
> + error_free(local_error);
> + error_exit("qemu_init_main_loop failed");
> + }
IMO it's okay to leak local_error here:
error_exit("%s", error_get_pretty(local_error));
qemu_init_main_loop failed is not a meaningful error message, please
drop it and keep just the detailed message.
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2014-09-16 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-14 10:23 [Qemu-devel] [PATCH v1] async: aio_context_new(): Handle event_notifier_init failure Chrysostomos Nanakos
2014-09-14 10:23 ` Chrysostomos Nanakos
2014-09-15 19:03 ` Benoît Canet
2014-09-15 19:59 ` Benoît Canet
2014-09-15 20:49 ` Chrysostomos Nanakos
2014-09-15 20:44 ` Chrysostomos Nanakos
2014-09-16 14:37 ` Stefan Hajnoczi
2014-09-16 14:43 ` Stefan Hajnoczi [this message]
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=20140916144313.GD10303@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=benoit@irqsave.net \
--cc=cnanakos@grnet.gr \
--cc=famz@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kroosec@gmail.com \
--cc=kwolf@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=pingfank@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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).