qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC 22/48] qdev: Fix -device and device_add to handl


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH RFC 22/48] qdev: Fix -device and device_add to handle unsuitable bus gracefully
Date: Wed, 24 Feb 2010 18:55:34 +0100

"device_add isa-serial,bus=pci.0" kills QEMU.  Not good.

Signed-off-by: Markus Armbruster <address@hidden>
---
 hw/qdev.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 38fc4e7..7def97d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -204,6 +204,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
     path = qemu_opt_get(opts, "bus");
     if (path != NULL) {
         bus = qbus_find(path);
+        if (bus && bus->info != info->bus_info) {
+            qemu_error("Device '%s' can't go on a %s bus",
+                       driver, bus->info->name);
+            return NULL;
+        }
     } else {
         bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
     }
-- 
1.6.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]