If a PCI device detach removal fails, returns the actual removal
operator error value.
Use this value within pci->unplug, as it may help applications solve an
issue with the feature or more accurately warn their users.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
{
struct rte_pci_addr *loc;
struct rte_pci_driver *dr;
+ int ret = 0;
if (dev == NULL)
return -EINVAL;
RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
- if (dr->remove && (dr->remove(dev) < 0))
- return -1; /* negative value is an error */
+ if (dr->remove) {
+ ret = dr->remove(dev);
+ if (ret < 0)
+ return ret;
+ }
/* clear driver structure */
dev->driver = NULL;
pdev = RTE_DEV_TO_PCI(dev);
ret = rte_pci_detach_dev(pdev);
- rte_pci_remove_device(pdev);
- free(pdev);
+ if (ret == 0) {
+ rte_pci_remove_device(pdev);
+ free(pdev);
+ }
return ret;
}