bus/fslmc: clear the vfio group on error

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Hemant Agrawal 2018-01-15 10:41:26 +05:30 committed by Thomas Monjalon
parent c564a2a200
commit 5329b95aae

View File

@ -637,12 +637,14 @@ fslmc_vfio_setup_group(void)
if (ret) {
FSLMC_VFIO_LOG(ERR, "VFIO error getting group status");
close(vfio_group.fd);
rte_vfio_clear_group(vfio_group.fd);
return ret;
}
if (!(status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
FSLMC_VFIO_LOG(ERR, "VFIO group not viable");
close(vfio_group.fd);
rte_vfio_clear_group(vfio_group.fd);
return -EPERM;
}
/* Since Group is VIABLE, Store the groupid */
@ -657,6 +659,7 @@ fslmc_vfio_setup_group(void)
"Error connecting container with groupid %d",
groupid);
close(vfio_group.fd);
rte_vfio_clear_group(vfio_group.fd);
return ret;
}
}
@ -667,6 +670,7 @@ fslmc_vfio_setup_group(void)
FSLMC_VFIO_LOG(ERR, "Error getting device %s fd from group %d",
g_container, vfio_group.groupid);
close(vfio_group.fd);
rte_vfio_clear_group(vfio_group.fd);
return ret;
}
container_device_fd = ret;