pci: unmap resources if probe fails

If resources were mapped prior to probe, unmap them
if probe fails.

This does not handle the case where the kernel driver was
forcibly unbound prior to probe.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
Ben Walker 2017-01-11 10:10:10 -07:00 committed by Thomas Monjalon
parent 6de5c0f130
commit e84ad157b7

View File

@ -210,8 +210,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
/* call the driver probe() function */
ret = dr->probe(dr, dev);
if (ret)
if (ret) {
dev->driver = NULL;
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
rte_eal_pci_unmap_device(dev);
}
return ret;
}