AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH libdrm 2/3] amdgpu: don't mess with shared_handle if amdgpu_bo_import() fails
Date: Sun, 22 Jan 2017 18:48:12 +0000	[thread overview]
Message-ID: <20170122184813.12995-2-emil.l.velikov@gmail.com> (raw)
In-Reply-To: <20170122184813.12995-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-01-22 18:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22 18:48 [PATCH libdrm 1/3] amdgpu: add missing unlock on drmPrimeFDToHandle() failure Emil Velikov
     [not found] ` <20170122184813.12995-1-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-22 18:48   ` Emil Velikov [this message]
2017-01-23 16:14     ` [PATCH libdrm 2/3] amdgpu: don't mess with shared_handle if amdgpu_bo_import() fails Nicolai Hähnle
2017-01-24  3:53       ` Emil Velikov
2017-01-23 16:15   ` [PATCH libdrm 1/3] amdgpu: add missing unlock on drmPrimeFDToHandle() failure Nicolai Hähnle
2017-01-22 18:48 ` [PATCH libdrm 3/3] amdgpu: rework and remove amdgpu_get_auth() Emil Velikov
2017-03-07  0:45   ` Emil Velikov
     [not found]     ` <CACvgo50BMP2qZsFzJK7Jmc-sAJkz7NVGKz0XjxZP3dMGs7_wtg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-07  0:47       ` Emil Velikov
2017-08-21 12:31   ` Emil Velikov
2017-08-21 12:56     ` Christian König
2017-08-21 16:37     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170122184813.12995-2-emil.l.velikov@gmail.com \
    --to=emil.l.velikov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox