mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 20:19:44 +00:00
qdev: skip bus check for bus-less devices in qdev_unplug()
Since commit 2f7bd829db
"qdev: Fix device_add bus assumptions"
it's possible to device_add bus-less device, but if such device is
unplugged it will dereference NULL parent_bus in qdev_unplug().
Fix it by taking in account that parent_bus might be NULL and
skipping bus check.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-id: 1367587536-14964-1-git-send-email-imammedo@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
6f32a6b47e
commit
120dc38f61
@ -208,7 +208,7 @@ void qdev_unplug(DeviceState *dev, Error **errp)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (!dev->parent_bus->allow_hotplug) {
|
||||
if (dev->parent_bus && !dev->parent_bus->allow_hotplug) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user