From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYAIH-0005Wi-8G for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:25:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYAIB-0003TJ-25 for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:25:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYAIA-0003RZ-QX for qemu-devel@nongnu.org; Thu, 10 Apr 2014 04:25:02 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3A8P26P013873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 10 Apr 2014 04:25:02 -0400 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3A8OlId005705 for ; Thu, 10 Apr 2014 04:25:01 -0400 From: Laszlo Ersek Date: Thu, 10 Apr 2014 10:24:42 +0200 Message-Id: <1397118285-11715-14-git-send-email-lersek@redhat.com> In-Reply-To: <1397118285-11715-1-git-send-email-lersek@redhat.com> References: <1397118285-11715-1-git-send-email-lersek@redhat.com> Subject: [Qemu-devel] [PATCH 13/16] pci-assign: propagate errors from assigned_dev_register_regions() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Laszlo Ersek --- hw/i386/kvm/pci-assign.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index 3a904e8..9aa92a1 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -392,13 +392,14 @@ static uint8_t pci_find_cap_offset(PCIDevice *d, uint8_t cap, uint8_t start) pos += PCI_CAP_LIST_NEXT; } return 0; } -static int assigned_dev_register_regions(PCIRegion *io_regions, - unsigned long regions_num, - AssignedDevice *pci_dev) +static void assigned_dev_register_regions(PCIRegion *io_regions, + unsigned long regions_num, + AssignedDevice *pci_dev, + Error **errp) { uint32_t i; PCIRegion *cur_region = io_regions; for (i = 0; i < regions_num; i++, cur_region++) { @@ -423,13 +424,13 @@ static int assigned_dev_register_regions(PCIRegion *io_regions, cur_region->resource_fd, (off_t)0); if (pci_dev->v_addrs[i].u.r_virtbase == MAP_FAILED) { pci_dev->v_addrs[i].u.r_virtbase = NULL; - error_report("%s: Error: Couldn't mmap 0x%" PRIx64 "!", - __func__, cur_region->base_addr); - return -1; + error_setg_errno(errp, errno, "Couldn't mmap 0x%" PRIx64 "!", + cur_region->base_addr); + return; } pci_dev->v_addrs[i].r_size = cur_region->size; pci_dev->v_addrs[i].e_size = 0; @@ -494,11 +495,10 @@ static int assigned_dev_register_regions(PCIRegion *io_regions, &pci_dev->v_addrs[i].container); } } /* success */ - return 0; } static void get_real_id(const char *devpath, const char *idname, uint16_t *val, Error **errp) { @@ -1794,13 +1794,16 @@ static int assigned_initfn(struct PCIDevice *pci_dev) goto out; } } /* handle real device's MMIO/PIO BARs */ - if (assigned_dev_register_regions(dev->real_device.regions, - dev->real_device.region_number, - dev)) { + assigned_dev_register_regions(dev->real_device.regions, + dev->real_device.region_number, dev, + &local_err); + if (local_err) { + qerror_report_err(local_err); + error_free(local_err); goto out; } /* handle interrupt routing */ e_intx = dev->dev.config[PCI_INTERRUPT_PIN] - 1; -- 1.8.3.1