From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZpq-0004Em-4s for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:24:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPZpk-00017h-Pn for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:24:34 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43146 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPZpk-00017Z-Iw for qemu-devel@nongnu.org; Thu, 04 Sep 2014 12:24:28 -0400 Message-ID: <5408923B.2020302@suse.de> Date: Thu, 04 Sep 2014 18:24:27 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1409797106-9076-1-git-send-email-arei.gonglei@huawei.com> <1409797106-9076-3-git-send-email-arei.gonglei@huawei.com> In-Reply-To: <1409797106-9076-3-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6 2/3] qdev: using NULL instead of local_err for qbus_child unrealize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: peter.crosthwaite@xilinx.com, weidong.huang@huawei.com, mst@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, pbonzini@redhat.com, imammedo@redhat.com Am 04.09.2014 04:18, schrieb arei.gonglei@huawei.com: > From: Gonglei >=20 > Forcefully unrealize all children regardless of early-iteration > errors(if happened). We should keep going with cleanup operation > rather than report a error immediately, meanwhile store the first > child unrealize failure and propagate it at the end. We also > forcefully un-vmsding and unrealizing actual object too. >=20 > Signed-off-by: Gonglei > Reviewed-by: Peter Crosthwaite > --- > hw/core/qdev.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index 4a1ac5b..6f37cd3 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -871,18 +871,18 @@ static void device_set_realized(Object *obj, bool= value, Error **errp) > } > dev->pending_deleted_event =3D false; > } else if (!value && dev->realized) { > + Error **local_errp =3D NULL; > QLIST_FOREACH(bus, &dev->child_bus, sibling) { > + local_errp =3D local_err ? NULL : &local_err; > object_property_set_bool(OBJECT(bus), false, "realized", > - &local_err); > - if (local_err !=3D NULL) { > - break; > - } > + local_errp); > } > - if (qdev_get_vmsd(dev) && local_err =3D=3D NULL) { > + if (qdev_get_vmsd(dev)) { > vmstate_unregister(dev, qdev_get_vmsd(dev), dev); > } > - if (dc->unrealize && local_err =3D=3D NULL) { > - dc->unrealize(dev, &local_err); > + if (dc->unrealize) { > + local_errp =3D local_err ? NULL : &local_err; > + dc->unrealize(dev, local_errp); > } > dev->pending_deleted_event =3D true; > } This looks much cleaner now, thanks, applied. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg