Patchwork [RFC,2/8] qdev: qdev_create(): use error_report() instead of hw_error()

login
register
mail settings
Submitter Eduardo Habkost
Date Dec. 4, 2012, 1:19 p.m.
Message ID <1354627180-25704-3-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/203622/
State New
Headers show

Comments

Eduardo Habkost - Dec. 4, 2012, 1:19 p.m.
hw_error() is specific for fatal hardware emulation errors, not for
internal errors related to the qdev object/class abstraction or object
initialization.

Replace it with an error_report() call, followed by abort().

This will also help reduce dependencies of the qdev code (as hw_error()
is from cpus.o, and depends on the CPU list from exec.o).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/qdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Andreas Färber - Dec. 4, 2012, 4:12 p.m.
Am 04.12.2012 14:19, schrieb Eduardo Habkost:
> hw_error() is specific for fatal hardware emulation errors, not for
> internal errors related to the qdev object/class abstraction or object
> initialization.
> 
> Replace it with an error_report() call, followed by abort().
> 
> This will also help reduce dependencies of the qdev code (as hw_error()
> is from cpus.o, and depends on the CPU list from exec.o).
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

This was already posted as a PATCH and I thought I had acked it ...
seems I didn't, so I re-checked cpus.c:hw_error() to abort() as well:

Acked-by: Andreas Färber <afaerber@suse.de>

Andreas

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index 788b4da..599382c 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -109,10 +109,12 @@  DeviceState *qdev_create(BusState *bus, const char *name)
     dev = qdev_try_create(bus, name);
     if (!dev) {
         if (bus) {
-            hw_error("Unknown device '%s' for bus '%s'\n", name,
-                     object_get_typename(OBJECT(bus)));
+            error_report("Unknown device '%s' for bus '%s'\n", name,
+                         object_get_typename(OBJECT(bus)));
+            abort();
         } else {
-            hw_error("Unknown device '%s' for default sysbus\n", name);
+            error_report("Unknown device '%s' for default sysbus\n", name);
+            abort();
         }
     }