From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTyZ-0000Mt-1W for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCTyX-0001T9-OB for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:35:58 -0400 Date: Tue, 7 Jul 2015 15:35:49 +0100 From: Stefan Hajnoczi Message-ID: <20150707143549.GF28673@stefanha-thinkpad.redhat.com> References: <1435670385-625-1-git-send-email-famz@redhat.com> <1435670385-625-4-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="udcq9yAoWb9A4FsZ" Content-Disposition: inline In-Reply-To: <1435670385-625-4-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH RFC 3/4] aio: Introduce aio_context_setup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org --udcq9yAoWb9A4FsZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 30, 2015 at 09:19:44PM +0800, Fam Zheng wrote: > diff --git a/async.c b/async.c > index 06971f4..1d70cfd 100644 > --- a/async.c > +++ b/async.c > @@ -290,12 +290,17 @@ AioContext *aio_context_new(Error **errp) > { > int ret; > AioContext *ctx; > + Error *local_err =3D NULL; > + > ctx =3D (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioCon= text)); > + aio_context_setup(ctx, &local_err); > + if (local_err) { > + error_propagate(errp, local_err); Is there any reason to introduce local_err? errp can be passed directly into aio_context_setup(). > + goto fail; > + } > ret =3D event_notifier_init(&ctx->notifier, false); > if (ret < 0) { > - g_source_destroy(&ctx->source); > - error_setg_errno(errp, -ret, "Failed to initialize event notifie= r"); > - return NULL; > + goto fail; > } > g_source_set_can_recurse(&ctx->source, true); > aio_set_event_notifier(ctx, &ctx->notifier, > @@ -307,6 +312,10 @@ AioContext *aio_context_new(Error **errp) > timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); > =20 > return ctx; > +fail: > + g_source_destroy(&ctx->source); > + error_setg_errno(errp, -ret, "Failed to initialize event notifier"); If aio_context_setup() failed then this hits the *errp =3D=3D NULL assertion failure in error_setg_errno(). This call shouldn't be moved away from the event_notifier_init() call. --udcq9yAoWb9A4FsZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVm+PFAAoJEJykq7OBq3PIhKkIAL4CdlAaTKckmvMxiCyt6rb1 L2sLqebwd/PTBg5dveoqeui+a3s3cioqZDwbEnmf527DMU2vGwBlsUXrr962Je7h zMWNEWnnZpSVzkJI3Oq1++nmK5drPZsriEQKCiDNATA/0GuCbOy8D2wYSAu4UPjx SIqBQ2w7XU2SZGxZr72ss6lQD2S0CVF/+VZwh6/qHxE1bpel2nHLpHCYyLr5y1Mn T7SwOpQfqo730tbZeP4UicU9Tqzwh3SQGTJOhkhAbJ2bWJ9ogZJ1qiq4cG8P6egV 3xddrJpWnbr+wIhvMRxKrCFXWxhJbed+cJRmwQr++1XTW82zp+r5yHnbOWo8aQs= =DT/l -----END PGP SIGNATURE----- --udcq9yAoWb9A4FsZ--