From patchwork Thu Sep 18 09:13:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 390691 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E54E51401E7 for ; Thu, 18 Sep 2014 19:17:50 +1000 (EST) Received: from localhost ([::1]:49270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUXqU-0003OQ-Un for incoming@patchwork.ozlabs.org; Thu, 18 Sep 2014 05:17:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUXq8-00037E-JW for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:17:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUXq3-0005w7-OR for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:17:24 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:52560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUXq2-0005oF-Nc for qemu-devel@nongnu.org; Thu, 18 Sep 2014 05:17:19 -0400 Received: from 172.24.2.119 (EHLO szxeml421-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BZQ13411; Thu, 18 Sep 2014 17:13:59 +0800 (CST) Received: from localhost (10.177.19.102) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Thu, 18 Sep 2014 17:13:51 +0800 From: To: Date: Thu, 18 Sep 2014 17:13:47 +0800 Message-ID: <1411031627-7336-1-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: Gonglei , weidong.huang@huawei.com, armbru@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v2] pci-hotplug-old: avoid lossing error message X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gonglei When scsi_bus_legacy_add_drive() produce error, we will loss error message. Using error_report report it. Cc: Markus Armbruster Signed-off-by: Gonglei Reviewed-by: Markus Armbruster --- 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;