From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmnCR-0000h4-7U for qemu-devel@nongnu.org; Mon, 27 Apr 2015 13:52:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmnCN-0004rP-Mo for qemu-devel@nongnu.org; Mon, 27 Apr 2015 13:52:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmnCN-0004r9-E9 for qemu-devel@nongnu.org; Mon, 27 Apr 2015 13:52:03 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3RHq1A3012464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 27 Apr 2015 13:52:02 -0400 From: Thomas Huth Date: Mon, 27 Apr 2015 19:51:57 +0200 Message-Id: <1430157117-26104-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH] pci: Clean up error reporting in pci_nic_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, "Michael S. Tsirkin" Cc: Markus Armbruster The error reporting in pci_nic_init() is quite erratic: Some errors are printed directly with error_report(), and some are passed back to the (only) caller pci_nic_init_nofail() via an Error pointer. Let's fix up this inconsistency by always printing the error in pci_nic_init() and by getting rid of the Error pointer this way. Signed-off-by: Thomas Huth --- hw/pci/pci.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b3d5100..6dac107 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1613,8 +1613,7 @@ static const char * const pci_nic_names[] = { /* Initialize a PCI NIC. */ static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus, const char *default_model, - const char *default_devaddr, - Error **errp) + const char *default_devaddr) { const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr; Error *err = NULL; @@ -1641,7 +1640,7 @@ static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus, object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err) { - error_propagate(errp, err); + error_report_err(err); object_unparent(OBJECT(dev)); return NULL; } @@ -1652,17 +1651,13 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, const char *default_model, const char *default_devaddr) { - Error *err = NULL; PCIDevice *res; if (qemu_show_nic_models(nd->model, pci_nic_models)) exit(0); - res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err); + res = pci_nic_init(nd, rootbus, default_model, default_devaddr); if (!res) { - if (err) { - error_report_err(err); - } exit(1); } return res; -- 1.8.3.1