提交 fcd61af6 编写于 作者: S Stefan Weil 提交者: Aurelien Jarno

qdev: sysbus_get_default must not return a NULL pointer (fix regression)

Every system should have some sort of main system bus,
so sysbus_get_default should always return a valid bus.

Without this patch, at least mipssim and malta no longer
start but raise a null pointer access exception (caused by
commit ec990eb6).

Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: NStefan Weil <weil@mail.berlios.de>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 e0087e61
......@@ -107,10 +107,7 @@ DeviceState *qdev_create(BusState *bus, const char *name)
DeviceInfo *info;
if (!bus) {
if (!main_system_bus) {
main_system_bus = qbus_create(&system_bus_info, NULL, "main-system-bus");
}
bus = main_system_bus;
bus = sysbus_get_default();
}
info = qdev_find_info(bus->info, name);
......@@ -311,6 +308,10 @@ static int qdev_reset_one(DeviceState *dev, void *opaque)
BusState *sysbus_get_default(void)
{
if (!main_system_bus) {
main_system_bus = qbus_create(&system_bus_info, NULL,
"main-system-bus");
}
return main_system_bus;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册