[PATCH libdrm 2/3] amdgpu: don't mess with shared_handle if amdgpu_bo_import() fails
Emil Velikov
emil.l.velikov at gmail.com
Sun Jan 22 18:48:12 UTC 2017
Do not close the handle if someone else has created it. Afaict there's
no change of ownership implied if the function fails. Thus the caller is
responsible to doing the right thing - trying again, closing the handle
and/or other.
Cc: amd-gfx at lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
Not 100% sure if it's the correct thing.
---
amdgpu/amdgpu_bo.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index c9f31587..24fa8880 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -310,7 +310,6 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
size = lseek(shared_handle, 0, SEEK_END);
if (size == (off_t)-1) {
pthread_mutex_unlock(&dev->bo_table_mutex);
- amdgpu_close_kms_handle(dev, handle);
return -errno;
}
lseek(shared_handle, 0, SEEK_SET);
@@ -355,9 +354,6 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
bo = calloc(1, sizeof(struct amdgpu_bo));
if (!bo) {
pthread_mutex_unlock(&dev->bo_table_mutex);
- if (type == amdgpu_bo_handle_type_dma_buf_fd) {
- amdgpu_close_kms_handle(dev, shared_handle);
- }
return -ENOMEM;
}
--
2.11.0
More information about the dri-devel
mailing list