diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci-hotplug.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index e7fb780a08..0ca5546fc6 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -80,7 +80,13 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, SCSIBus *scsibus; SCSIDevice *scsidev; - scsibus = SCSI_BUS(QLIST_FIRST(&adapter->child_bus)); + scsibus = (SCSIBus *) + object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)), + TYPE_SCSI_BUS); + if (!scsibus) { + error_report("Device is not a SCSI adapter"); + return -1; + } /* * drive_init() tries to find a default for dinfo->unit. Doesn't |