aboutsummaryrefslogtreecommitdiff
path: root/hw/pci/pci-hotplug-old.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-09-18 21:06:17 +0800
committerMichael S. Tsirkin <mst@redhat.com>2014-09-29 19:44:04 +0300
commit22b80e85ff7d6150beefe06bb43d9b14ac4deb05 (patch)
tree11696663f33e75a44f6ac0d07f4dbdb34410357f /hw/pci/pci-hotplug-old.c
parent45363e46aeebfc99753389649eac7c7fc22bfe52 (diff)
pci-hotplug-old: avoid losing error message
When scsi_bus_legacy_add_drive() produces an error, we will lose the error message. Using error_report to report it. Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci/pci-hotplug-old.c')
-rw-r--r--hw/pci/pci-hotplug-old.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c
index cf2caebfb1..d87c469096 100644
--- a/hw/pci/pci-hotplug-old.c
+++ b/hw/pci/pci-hotplug-old.c
@@ -107,6 +107,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
{
SCSIBus *scsibus;
SCSIDevice *scsidev;
+ Error *local_err = NULL;
scsibus = (SCSIBus *)
object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
@@ -127,8 +128,10 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1);
dinfo->bus = scsibus->busnr;
scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo->unit,
- false, -1, NULL, NULL);
+ false, -1, NULL, &local_err);
if (!scsidev) {
+ error_report("%s", error_get_pretty(local_err));
+ error_free(local_err);
return -1;
}
dinfo->unit = scsidev->id;