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
ec990eb622ad46df5ddcb1e94c418c271894d416).
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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);
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;
}