summaryrefslogtreecommitdiff
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r--hw/core/qdev.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 35fd00d26c..ef06aa4d48 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -938,7 +938,12 @@ void qdev_alias_all_properties(DeviceState *target, Object *source)
static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
{
GSList **list = opaque;
- DeviceState *dev = DEVICE(obj);
+ DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
+ TYPE_DEVICE);
+
+ if (dev == NULL) {
+ return 0;
+ }
if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) {
*list = g_slist_append(*list, dev);