mirror of https://gitee.com/openkylin/qemu.git
qdev: Fix bus dependency of DeviceState::hotpluggable getter
Commit 1a37eca107
(qdev: add
"hotpluggable" property to Device) added a property "hotpluggable" to
each device, with its getter accessing parent_bus->allow_hotplug.
Add a NULL check.
Cc: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
750036a848
commit
2b81b35f8f
|
@ -735,7 +735,8 @@ static bool device_get_hotpluggable(Object *obj, Error **err)
|
|||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
||||
return dc->hotpluggable && dev->parent_bus->allow_hotplug;
|
||||
return dc->hotpluggable && (dev->parent_bus == NULL ||
|
||||
dev->parent_bus->allow_hotplug);
|
||||
}
|
||||
|
||||
static void device_initfn(Object *obj)
|
||||
|
|
Loading…
Reference in New Issue