anv: Check file descriptor before closing.

Fix defect reported by Coverity Scan.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be negative

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6643>
This commit is contained in:
Vinson Lee
2020-09-07 18:34:46 -07:00
parent 1d71b1a311
commit 93b8cdfe8b

View File

@@ -1915,7 +1915,8 @@ VkResult anv_ImportFenceFdKHR(
* *
* If the import fails, we leave the file descriptor open. * If the import fails, we leave the file descriptor open.
*/ */
close(fd); if (fd != -1)
close(fd);
if (pImportFenceFdInfo->flags & VK_FENCE_IMPORT_TEMPORARY_BIT) { if (pImportFenceFdInfo->flags & VK_FENCE_IMPORT_TEMPORARY_BIT) {
anv_fence_impl_cleanup(device, &fence->temporary); anv_fence_impl_cleanup(device, &fence->temporary);