From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtre-0000Ha-4f for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:37:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYtrZ-0000eS-7C for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:36:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtrY-0000cj-V9 for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:36:53 -0400 Date: Tue, 30 Sep 2014 12:40:07 +0300 From: "Michael S. Tsirkin" Message-ID: <1412069893-4717-4-git-send-email-mst@redhat.com> References: <1412069893-4717-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1412069893-4717-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 3/5] pci-hotplug-old: avoid losing error message List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Gonglei , Markus Armbruster , Anthony Liguori From: Gonglei When scsi_bus_legacy_add_drive() produces an error, we will lose the error message. Using error_report to report it. Cc: Markus Armbruster Signed-off-by: Gonglei Reviewed-by: Markus Armbruster Reviewed-by: Eric Blake Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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; -- MST