Add Error **errp for xen_host_pci_device_get()

To catch the error message. Also modify the caller

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Cao jin 2016-01-17 20:13:12 +08:00 committed by Stefano Stabellini
parent f524bc3b3d
commit 376ba75f88
3 changed files with 68 additions and 52 deletions

View file

@ -767,6 +767,7 @@ static int xen_pt_initfn(PCIDevice *d)
uint8_t machine_irq = 0, scratch;
uint16_t cmd = 0;
int pirq = XEN_PT_UNASSIGNED_PIRQ;
Error *err = NULL;
/* register real device */
XEN_PT_LOG(d, "Assigning real physical device %02x:%02x.%d"
@ -774,11 +775,13 @@ static int xen_pt_initfn(PCIDevice *d)
s->hostaddr.bus, s->hostaddr.slot, s->hostaddr.function,
s->dev.devfn);
rc = xen_host_pci_device_get(&s->real_device,
s->hostaddr.domain, s->hostaddr.bus,
s->hostaddr.slot, s->hostaddr.function);
if (rc) {
XEN_PT_ERR(d, "Failed to \"open\" the real pci device. rc: %i\n", rc);
xen_host_pci_device_get(&s->real_device,
s->hostaddr.domain, s->hostaddr.bus,
s->hostaddr.slot, s->hostaddr.function,
&err);
if (err) {
error_append_hint(&err, "Failed to \"open\" the real pci device");
error_report_err(err);
return -1;
}