提交 2b81b35f 编写于 作者: A Andreas Färber

qdev: Fix bus dependency of DeviceState::hotpluggable getter

Commit 1a37eca1 (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: NAndreas Färber <afaerber@suse.de>
上级 750036a8
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册