]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qdev: Fix bus dependency of DeviceState::hotpluggable getter
authorAndreas Färber <afaerber@suse.de>
Fri, 7 Mar 2014 18:04:13 +0000 (19:04 +0100)
committerAndreas Färber <afaerber@suse.de>
Wed, 12 Mar 2014 19:13:02 +0000 (20:13 +0100)
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>
hw/core/qdev.c

index 380976a0665d7b10e377a1e5d887da17836408d5..53778938e609ba11fa8f5844704ae0fae4ac95f7 100644 (file)
@@ -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)