From 327867b62a121a93ab1e8e9278eba2cd44eee650 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 19:08:45 +0100 Subject: [PATCH] qdev: Fix -device and device_add to handle unsuitable bus gracefully "device_add isa-serial,bus=pci.0" kills QEMU. Not good. --- hw/qdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/qdev.c b/hw/qdev.c index 8bf86a5f1f..3fe811f632 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); }