RTE_LOG(DEBUG, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id,
dev->id.device_id, dr->driver.name);
- /*
- * reference driver structure
- * This needs to be before rte_pci_map_device(), as it enables to use
- * driver flags for adjusting configuration.
- */
if (!already_probed) {
enum rte_iova_mode dev_iova_mode;
enum rte_iova_mode iova_mode;
return -ENOMEM;
}
- if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
+ /*
+ * Reference driver structure.
+ * This needs to be before rte_pci_map_device(), as it enables
+ * to use driver flags for adjusting configuration.
+ */
+ dev->driver = dr;
+ if (dev->driver->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
ret = rte_pci_map_device(dev);
if (ret != 0) {
+ dev->driver = NULL;
rte_intr_instance_free(dev->vfio_req_intr_handle);
dev->vfio_req_intr_handle = NULL;
rte_intr_instance_free(dev->intr_handle);
return ret;
}
}
-
- dev->driver = dr;
}
RTE_LOG(INFO, EAL, "Probe PCI driver: %s (%x:%x) device: "PCI_PRI_FMT" (socket %i)\n",
return ret; /* no rollback if already succeeded earlier */
if (ret) {
dev->driver = NULL;
- rte_intr_instance_free(dev->vfio_req_intr_handle);
- dev->vfio_req_intr_handle = NULL;
- rte_intr_instance_free(dev->intr_handle);
- dev->intr_handle = NULL;
if ((dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) &&
/* Don't unmap if device is unsupported and
* driver needs mapped resources.
!(ret > 0 &&
(dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES)))
rte_pci_unmap_device(dev);
+ rte_intr_instance_free(dev->vfio_req_intr_handle);
+ dev->vfio_req_intr_handle = NULL;
+ rte_intr_instance_free(dev->intr_handle);
+ dev->intr_handle = NULL;
} else {
dev->device.driver = &dr->driver;
}
/* clear driver structure */
dev->driver = NULL;
dev->device.driver = NULL;
- rte_intr_instance_free(dev->intr_handle);
- dev->intr_handle = NULL;
- rte_intr_instance_free(dev->vfio_req_intr_handle);
- dev->vfio_req_intr_handle = NULL;
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
/* unmap resources for devices that use igb_uio */
rte_pci_unmap_device(dev);
+ rte_intr_instance_free(dev->intr_handle);
+ dev->intr_handle = NULL;
+ rte_intr_instance_free(dev->vfio_req_intr_handle);
+ dev->vfio_req_intr_handle = NULL;
+
return 0;
}