aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wright <chrisw@sous-sol.org>2008-04-21 22:14:57 -0700
committerAvi Kivity <avi@qumranet.com>2008-04-22 14:21:03 +0300
commit7f1f41acb9654fbc55d78e0e7ef2222d4eaad3c8 (patch)
tree77d138c0e281b08d93972b8d639c45e9ee302645
parentadd9c7bbe3c9e89823e81f375ba5498196498a22 (diff)
Hotadd: lsi_scsi_init can failkvm-67rc1
During hotadd of SCSI devices lsi_scsi_init() handles failed pci_device_register(), but qemu_system_hot_add_storage() will try and attach a drive any way. Handle this error case rather the generating SEGV. Cc: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--hw/device-hotplug.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
index 95b3c7b24..5e2f2f022 100644
--- a/hw/device-hotplug.c
+++ b/hw/device-hotplug.c
@@ -125,7 +125,7 @@ static PCIDevice *qemu_system_hot_add_storage(const char *opts, int bus_nr)
switch (type) {
case IF_SCSI:
opaque = lsi_scsi_init (pci_bus, -1);
- if (drive_idx >= 0)
+ if (opaque && drive_idx >= 0)
lsi_scsi_attach (opaque, drives_table[drive_idx].bdrv,
drives_table[drive_idx].unit);
break;