summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-02-19 19:08:45 +0100
committerMarkus Armbruster <armbru@redhat.com>2010-03-16 16:58:32 +0100
commit327867b62a121a93ab1e8e9278eba2cd44eee650 (patch)
treec46385cc743836e94501673bcc8d41c67c5c012b
parent0f0bc3f1d526924ef4a75ad25dd0ec3771a66496 (diff)
downloadhqemu-327867b62a121a93ab1e8e9278eba2cd44eee650.zip
hqemu-327867b62a121a93ab1e8e9278eba2cd44eee650.tar.gz
qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU. Not good.
-rw-r--r--hw/qdev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 8bf86a5..3fe811f 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) {
+ error_report("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);
}
OpenPOWER on IntegriCloud