Commit fd359932 authored by yidong0635's avatar yidong0635 Committed by Tomasz Zawadzki
Browse files

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: default avataryidong0635 <dongx.yi@intel.com>
Change-Id: I28028dda2977cf8158e703afa5b8af38c48f3d85
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6922


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 6e2c2306
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -388,7 +388,6 @@ spdk_vfio_user_setup(const char *path)
	ret = vfio_user_get_dev_info(device, &dev_info, sizeof(dev_info));
	if (ret) {
		SPDK_ERRLOG("Device get info failed\n");
		close(device->fd);
		goto cleanup;
	}
	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);
	if (ret) {
		close(device->fd);
		goto cleanup;
	}

@@ -404,7 +402,6 @@ spdk_vfio_user_setup(const char *path)
	ret = vfio_device_dma_map(device);
	if (ret) {
		SPDK_ERRLOG("Container DMA map failed\n");
		close(device->fd);
		goto cleanup;
	}

@@ -414,6 +411,7 @@ spdk_vfio_user_setup(const char *path)
	return device;

cleanup:
	close(device->fd);
	free(device);
	return NULL;
}