From patchwork Thu Sep 18 12:58:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 390824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44A6E140085 for ; Thu, 18 Sep 2014 23:02:45 +1000 (EST) Received: from localhost ([::1]:50606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUbMB-0002Z8-UD for incoming@patchwork.ozlabs.org; Thu, 18 Sep 2014 09:02:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUbIZ-0004sS-DG for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:59:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUbIU-0000V1-Hr for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:58:59 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:18788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUbIT-0000T4-Lv for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:58:54 -0400 Received: from 172.24.2.119 (EHLO szxeml459-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BZQ34829; Thu, 18 Sep 2014 20:58:32 +0800 (CST) Received: from localhost (10.177.19.102) by szxeml459-hub.china.huawei.com (10.82.67.202) with Microsoft SMTP Server id 14.3.158.1; Thu, 18 Sep 2014 20:58:26 +0800 From: To: Date: Thu, 18 Sep 2014 20:58:21 +0800 Message-ID: <1411045101-11424-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 v3] 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() 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 --- v3: fix some typos/grammar issues (Eric) and add 'R-by' tag 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;