From ca37efbec6339be2cac82fe8faf11a076efe94a1 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 9 Jan 2012 13:37:29 +0100
Subject: [PATCH 2/9] qdev: Don't hw_error() in qdev_init_nofail()

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1326116256-3685-3-git-send-email-armbru@redhat.com>
Patchwork-id: 36281
O-Subject: [RHEL-6.3 PATCH qemu-kvm 2/9] qdev: Don't hw_error() in qdev_init_nofail()
Bugzilla: 737879
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>

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 <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit bd6c9a617d969752c9d3663f6ad29ae6d6d6c402)
---
 hw/qdev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/qdev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index eafb463..b630284 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -328,8 +328,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.7.7.4

