From patchwork Tue Sep 25 16:03:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 974600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42KRDV71Nwz9s3C for ; Wed, 26 Sep 2018 02:22:18 +1000 (AEST) Received: from localhost ([::1]:54211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4q6J-0003z5-8B for incoming@patchwork.ozlabs.org; Tue, 25 Sep 2018 12:22:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4pol-000469-0V for qemu-devel@nongnu.org; Tue, 25 Sep 2018 12:04:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4poe-0006ru-SE for qemu-devel@nongnu.org; Tue, 25 Sep 2018 12:04:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42322) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4poe-0006qE-FM for qemu-devel@nongnu.org; Tue, 25 Sep 2018 12:04:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4748881DF0; Tue, 25 Sep 2018 16:03:59 +0000 (UTC) Received: from thuth.com (ovpn-116-102.ams2.redhat.com [10.36.116.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D09D60BE8; Tue, 25 Sep 2018 16:03:58 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Date: Tue, 25 Sep 2018 18:03:43 +0200 Message-Id: <1537891427-24148-10-git-send-email-thuth@redhat.com> In-Reply-To: <1537891427-24148-1-git-send-email-thuth@redhat.com> References: <1537891427-24148-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 25 Sep 2018 16:03:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/13] hw/qdev-core: Fix description of instance_init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The part of the documentation of DeviceClass that talks about instance_init is partly wrong: instance_init() functions must not abort or exit, since the function is also called during introspection of the device already. So if a device calls exit() during its instance_init() function, QEMU terminates unexpectedly if somebody tries to just have a look at the interfaces from the device with "device_add xyz,help" or with the "device-list-properties" QOM command. This should never happen. Reviewed-by: Andreas Färber Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth --- include/hw/qdev-core.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index f1fd0f8..a24d0dd 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -51,8 +51,9 @@ struct VMStateDescription; * Devices are constructed in two stages, * 1) object instantiation via object_initialize() and * 2) device realization via #DeviceState:realized property. - * The former may not fail (it might assert or exit), the latter may return - * error information to the caller and must be re-entrant. + * The former may not fail (and must not abort or exit, since it is called + * during device introspection already), and the latter may return error + * information to the caller and must be re-entrant. * Trivial field initializations should go into #TypeInfo.instance_init. * Operations depending on @props static properties should go into @realize. * After successful realization, setting static properties will fail.