Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeWnN-0004E7-J3 for qemu-devel@nongnu.org; Fri, 21 Aug 2009 12:16:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeWnI-0004Bd-HZ for qemu-devel@nongnu.org; Fri, 21 Aug 2009 12:16:52 -0400 Received: from [199.232.76.173] (port=58443 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeWnI-0004BZ-BD for qemu-devel@nongnu.org; Fri, 21 Aug 2009 12:16:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63307) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MeWnH-0001Ec-RI for qemu-devel@nongnu.org; Fri, 21 Aug 2009 12:16:48 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7LGGkUt018573 for ; Fri, 21 Aug 2009 12:16:47 -0400 Subject: Re: [Qemu-devel] [PATCH 1/4] qdev: add return value to init() callbacks. References: <1250238968-2114-1-git-send-email-kraxel@redhat.com> From: Markus Armbruster Date: Fri, 21 Aug 2009 18:16:40 +0200 In-Reply-To: <1250238968-2114-1-git-send-email-kraxel@redhat.com> (Gerd Hoffmann's message of "Fri\, 14 Aug 2009 10\:36\:05 +0200") Message-ID: <87ljld16s7.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann writes: > Sorry folks, but it has to be. One more of these invasive qdev patches. > > We have a serious design bug in the qdev interface: device init > callbacks can't signal failure because the init() callback has no > return value. This patch fixes it. > > We have already one case in-tree where this is needed: > Try -device virtio-blk-pci (without drive= specified) and watch qemu > segfault. This patch fixes it. > > With usb+scsi being converted to qdev we'll get more devices where the > init callback can fail for various reasons. > > Signed-off-by: Gerd Hoffmann Trivial rediff of the previous patch, for which I verified that we either * change a function returning void to return int instead, or * insert return 0 at the end of a function, or * change F() to return F(), for some F() that now returns int, or * insert return -1 instead of continuing to a crash, in virtio_blk_init_pci(), or * handle a failed device init(), in qdev_device_add(). Acked-by: Markus Armbruster