From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56648 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW7BO-0003VC-U2 for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:23:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OW6xQ-0003Is-KL for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:09:03 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:38907) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OW6xQ-0003IF-DS for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:09:00 -0400 From: Markus Armbruster Date: Tue, 6 Jul 2010 14:08:48 +0200 Message-Id: <1278418136-24556-6-git-send-email-armbru@redhat.com> In-Reply-To: <1278418136-24556-1-git-send-email-armbru@redhat.com> References: <1278418136-24556-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 05/13] qdev: Don't hw_error() in qdev_init_nofail() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de Some of the failures are internal errors, and hw_error() is okay then. But the common way to fail is bad user input, e.g. -global isa-fdc.driveA=foo where drive foo has an unsupported rerror value. exit(1) instead. Signed-off-by: Markus Armbruster --- hw/qdev.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 61f999c..00ceada 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -326,8 +326,10 @@ void qdev_init_nofail(DeviceState *dev) { DeviceInfo *info = dev->info; - if (qdev_init(dev) < 0) - hw_error("Initialization of device %s failed\n", info->name); + if (qdev_init(dev) < 0) { + error_report("Initialization of device %s failed\n", info->name); + exit(1); + } } /* Unlink device from bus and free the structure. */ -- 1.6.6.1