diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-10-18 14:34:42 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-10-19 23:13:28 +0200 |
commit | 840b4495ef5c2d90d75f3f0d00d9018146f27d8e (patch) | |
tree | ed095252089b1c4dadabc8a231721e006388c6f9 /hw | |
parent | 675d717b9ee2d8dea9cfdca9aa69ed97d8bc54d3 (diff) | |
download | qemu-840b4495ef5c2d90d75f3f0d00d9018146f27d8e.zip qemu-840b4495ef5c2d90d75f3f0d00d9018146f27d8e.tar.gz qemu-840b4495ef5c2d90d75f3f0d00d9018146f27d8e.tar.bz2 |
hw/s390x/css-bridge: Realize sysbus device before accessing it
qbus_new() should not be called on unrealized device.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20231019071611.98885-10-philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/s390x/css-bridge.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/s390x/css-bridge.c b/hw/s390x/css-bridge.c index 4017081..15d26ef 100644 --- a/hw/s390x/css-bridge.c +++ b/hw/s390x/css-bridge.c @@ -95,7 +95,6 @@ static const TypeInfo virtual_css_bus_info = { VirtualCssBus *virtual_css_bus_init(void) { - VirtualCssBus *cbus; BusState *bus; DeviceState *dev; @@ -103,19 +102,19 @@ VirtualCssBus *virtual_css_bus_init(void) dev = qdev_new(TYPE_VIRTUAL_CSS_BRIDGE); object_property_add_child(qdev_get_machine(), TYPE_VIRTUAL_CSS_BRIDGE, OBJECT(dev)); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); /* Create bus on bridge device */ bus = qbus_new(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css"); - cbus = VIRTUAL_CSS_BUS(bus); /* Enable hotplugging */ qbus_set_hotplug_handler(bus, OBJECT(dev)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + css_register_io_adapters(CSS_IO_ADAPTER_VIRTIO, true, false, 0, &error_abort); - return cbus; + return VIRTUAL_CSS_BUS(bus); } /***************** Virtual-css Bus Bridge Device ********************/ |