Currently, only the 'vfio_dev_fd' is closed in failure path, so
some resources are not released(such as 'vfio_group_fd'). The
rte_vfio_release_device() should be used to avoid this problem.
Fixes:
33604c31354a ("vfio: refactor PCI BAR mapping")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
err_vfio_res:
rte_free(vfio_res);
err_vfio_dev_fd:
- close(vfio_dev_fd);
+ rte_vfio_release_device(rte_pci_get_sysfs_path(),
+ pci_addr, vfio_dev_fd);
return -1;
}
return 0;
err_vfio_dev_fd:
- close(vfio_dev_fd);
+ rte_vfio_release_device(rte_pci_get_sysfs_path(),
+ pci_addr, vfio_dev_fd);
return -1;
}