summaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2014-03-07 19:04:13 +0100
committerAndreas Färber <afaerber@suse.de>2014-03-12 20:13:02 +0100
commit2b81b35f8f18d6874d1a0605ac5e40028966051b (patch)
treee991e01cf47290da7079a3424207908976a65753 /hw/core
parent750036a848ea913ba6343718ffa70da98f7eef6b (diff)
downloadqemu-2b81b35f8f18d6874d1a0605ac5e40028966051b.tar.gz
qdev: Fix bus dependency of DeviceState::hotpluggable getter
Commit 1a37eca107cece3ed454bae29eef0bd1fac4a244 (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>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/qdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 380976a066..53778938e6 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -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)