mirror of https://gitee.com/openkylin/qemu.git
qdev: Fix -device and device_add to handle unsuitable bus gracefully
"device_add isa-serial,bus=pci.0" kills QEMU. Not good.
This commit is contained in:
parent
0f0bc3f1d5
commit
327867b62a
|
@ -204,6 +204,11 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
||||||
path = qemu_opt_get(opts, "bus");
|
path = qemu_opt_get(opts, "bus");
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
bus = qbus_find(path);
|
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 {
|
} else {
|
||||||
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
|
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue