diff mbox

[v2] pci-hotplug-old: avoid lossing error message

Message ID 1411031627-7336-1-git-send-email-arei.gonglei@huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) Sept. 18, 2014, 9:13 a.m. UTC
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(-)

Comments

Markus Armbruster Sept. 18, 2014, 11:08 a.m. UTC | #1
<arei.gonglei@huawei.com> writes:

> 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>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Gonglei (Arei) Sept. 18, 2014, 11:51 a.m. UTC | #2
> From: Markus Armbruster [mailto:armbru@redhat.com]
> Sent: Thursday, September 18, 2014 7:09 PM
> Subject: Re: [Qemu-devel] [PATCH v2] pci-hotplug-old: avoid lossing error
> message
> 
> <arei.gonglei@huawei.com> writes:
> 
> > 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>
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

Thanks :)

Best regards,
-Gonglei
Eric Blake Sept. 18, 2014, 12:34 p.m. UTC | #3
On 09/18/2014 03:13 AM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> When scsi_bus_legacy_add_drive() produce error,
> we will loss error message. Using error_report
> report it.

Same typos/grammar issues as I flagged on v1.
diff mbox

Patch

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;