vfio_user_pci: put close(device->fd) in cleanup.
These three goto cases are using device->fd, so put them in cleanup, it has no impact on vfio_user_dev_setup failed. Signed-off-by: yidong0635 <dongx.yi@intel.com> Change-Id: I28028dda2977cf8158e703afa5b8af38c48f3d85 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6922 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
6e2c2306f9
commit
fd35993219
@ -388,7 +388,6 @@ spdk_vfio_user_setup(const char *path)
|
|||||||
ret = vfio_user_get_dev_info(device, &dev_info, sizeof(dev_info));
|
ret = vfio_user_get_dev_info(device, &dev_info, sizeof(dev_info));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
SPDK_ERRLOG("Device get info failed\n");
|
SPDK_ERRLOG("Device get info failed\n");
|
||||||
close(device->fd);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
device->pci_regions = dev_info.num_regions;
|
device->pci_regions = dev_info.num_regions;
|
||||||
@ -396,7 +395,6 @@ spdk_vfio_user_setup(const char *path)
|
|||||||
|
|
||||||
ret = vfio_device_map_bars_and_config_region(device);
|
ret = vfio_device_map_bars_and_config_region(device);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
close(device->fd);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +402,6 @@ spdk_vfio_user_setup(const char *path)
|
|||||||
ret = vfio_device_dma_map(device);
|
ret = vfio_device_dma_map(device);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
SPDK_ERRLOG("Container DMA map failed\n");
|
SPDK_ERRLOG("Container DMA map failed\n");
|
||||||
close(device->fd);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,6 +411,7 @@ spdk_vfio_user_setup(const char *path)
|
|||||||
return device;
|
return device;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
close(device->fd);
|
||||||
free(device);
|
free(device);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user