From patchwork Tue Jul 6 12:08:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2,05/13] qdev: Don't hw_error() in qdev_init_nofail() Date: Tue, 06 Jul 2010 02:08:48 -0000 From: Markus Armbruster X-Patchwork-Id: 58012 Message-Id: <1278418136-24556-6-git-send-email-armbru@redhat.com> 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 Reviewed-by: Christoph Hellwig --- 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. */