pci-assign: propagate errors from assigned_dev_register_regions()
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
7a98593b34
commit
7d9cb533f5
|
@ -394,9 +394,10 @@ static uint8_t pci_find_cap_offset(PCIDevice *d, uint8_t cap, uint8_t start)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int assigned_dev_register_regions(PCIRegion *io_regions,
|
static void assigned_dev_register_regions(PCIRegion *io_regions,
|
||||||
unsigned long regions_num,
|
unsigned long regions_num,
|
||||||
AssignedDevice *pci_dev)
|
AssignedDevice *pci_dev,
|
||||||
|
Error **errp)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
PCIRegion *cur_region = io_regions;
|
PCIRegion *cur_region = io_regions;
|
||||||
|
@ -425,9 +426,9 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
|
||||||
|
|
||||||
if (pci_dev->v_addrs[i].u.r_virtbase == MAP_FAILED) {
|
if (pci_dev->v_addrs[i].u.r_virtbase == MAP_FAILED) {
|
||||||
pci_dev->v_addrs[i].u.r_virtbase = NULL;
|
pci_dev->v_addrs[i].u.r_virtbase = NULL;
|
||||||
error_report("%s: Error: Couldn't mmap 0x%" PRIx64 "!",
|
error_setg_errno(errp, errno, "Couldn't mmap 0x%" PRIx64 "!",
|
||||||
__func__, cur_region->base_addr);
|
cur_region->base_addr);
|
||||||
return -1;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_dev->v_addrs[i].r_size = cur_region->size;
|
pci_dev->v_addrs[i].r_size = cur_region->size;
|
||||||
|
@ -496,7 +497,6 @@ static int assigned_dev_register_regions(PCIRegion *io_regions,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_real_id(const char *devpath, const char *idname, uint16_t *val,
|
static void get_real_id(const char *devpath, const char *idname, uint16_t *val,
|
||||||
|
@ -1796,9 +1796,12 @@ static int assigned_initfn(struct PCIDevice *pci_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle real device's MMIO/PIO BARs */
|
/* handle real device's MMIO/PIO BARs */
|
||||||
if (assigned_dev_register_regions(dev->real_device.regions,
|
assigned_dev_register_regions(dev->real_device.regions,
|
||||||
dev->real_device.region_number,
|
dev->real_device.region_number, dev,
|
||||||
dev)) {
|
&local_err);
|
||||||
|
if (local_err) {
|
||||||
|
qerror_report_err(local_err);
|
||||||
|
error_free(local_err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue