qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] pci-hotplug-old: avoid lossing error message
@ 2014-09-18  9:13 arei.gonglei
  2014-09-18 11:08 ` Markus Armbruster
  2014-09-18 12:34 ` Eric Blake
  0 siblings, 2 replies; 4+ messages in thread
From: arei.gonglei @ 2014-09-18  9:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gonglei, weidong.huang, armbru, mst

From: Gonglei <arei.gonglei@huawei.com>

When scsi_bus_legacy_add_drive() produce error,
we will loss error message. Using error_report
report it.

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
v2: using original condition instead of local_err (Markus)
---
 hw/pci/pci-hotplug-old.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c
index cf2caeb..d87c469 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;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-18 12:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18  9:13 [Qemu-devel] [PATCH v2] pci-hotplug-old: avoid lossing error message arei.gonglei
2014-09-18 11:08 ` Markus Armbruster
2014-09-18 11:51   ` Gonglei (Arei)
2014-09-18 12:34 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).