From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9GzA-00032x-3Q for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:35:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9Gz4-00061X-Fu for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:35:04 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:46464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Gz4-00061Q-8K for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:34:58 -0500 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jan 2015 10:34:57 -0700 From: Michael Roth Date: Thu, 8 Jan 2015 11:33:05 -0600 Message-Id: <1420738472-23267-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 01/88] qdev: Use NULL instead of local_err for qbus_child unrealize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org From: Gonglei Forcefully unrealize all children regardless of errors in earlier iterations (if any). We should keep going with cleanup operation rather than report an error immediately. Therefore store the first child unrealization failure and propagate it at the end. We also forcefully unregister vmsd and unrealize actual object, too. Signed-off-by: Gonglei Reviewed-by: Peter Crosthwaite Cc: qemu-stable@nongnu.org Signed-off-by: Andreas Färber (cherry picked from commit cd4520adcab70dbac8db3fe4d41836dca63715a4) Signed-off-by: Michael Roth --- hw/core/qdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index da1ba48..1a88865 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 = false; } else if (!value && dev->realized) { + Error **local_errp = NULL; QLIST_FOREACH(bus, &dev->child_bus, sibling) { + local_errp = local_err ? NULL : &local_err; object_property_set_bool(OBJECT(bus), false, "realized", - &local_err); - if (local_err != NULL) { - break; - } + local_errp); } - if (qdev_get_vmsd(dev) && local_err == NULL) { + if (qdev_get_vmsd(dev)) { vmstate_unregister(dev, qdev_get_vmsd(dev), dev); } - if (dc->unrealize && local_err == NULL) { - dc->unrealize(dev, &local_err); + if (dc->unrealize) { + local_errp = local_err ? NULL : &local_err; + dc->unrealize(dev, local_errp); } dev->pending_deleted_event = true; } -- 1.9.1