Skip to content
Snippets Groups Projects
Commit 675d717b authored by Philippe Mathieu-Daudé's avatar Philippe Mathieu-Daudé
Browse files

hw/isa: Realize ISA bridge device before accessing it


qbus_new() should not be called on unrealized device.

Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Message-Id: <20231019071611.98885-9-philmd@linaro.org>
parent 8a89bb06
No related branches found
No related tags found
No related merge requests found
......@@ -52,18 +52,25 @@ static const TypeInfo isa_bus_info = {
ISABus *isa_bus_new(DeviceState *dev, MemoryRegion* address_space,
MemoryRegion *address_space_io, Error **errp)
{
DeviceState *bridge = NULL;
if (isabus) {
error_setg(errp, "Can't create a second ISA bus");
return NULL;
}
if (!dev) {
dev = qdev_new("isabus-bridge");
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
bridge = qdev_new("isabus-bridge");
dev = bridge;
}
isabus = ISA_BUS(qbus_new(TYPE_ISA_BUS, dev, NULL));
isabus->address_space = address_space;
isabus->address_space_io = address_space_io;
if (bridge) {
sysbus_realize_and_unref(SYS_BUS_DEVICE(bridge), &error_fatal);
}
return isabus;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment