diff mbox

dma-buf/sw_sync: put fence reference from the fence creation

Message ID 1477515599-7685-1-git-send-email-gustavo@padovan.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gustavo Padovan Oct. 26, 2016, 8:59 p.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Once sw_sync_ioctl_create_fence() returns we no longer have the
*pt pointer to the fence base object thus we need to put the reference
we have from the fence creation to keep a correct reference accounting.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/dma-buf/sw_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chris Wilson Oct. 26, 2016, 9:54 p.m. UTC | #1
On Wed, Oct 26, 2016 at 06:59:59PM -0200, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Once sw_sync_ioctl_create_fence() returns we no longer have the
> *pt pointer to the fence base object thus we need to put the reference
> we have from the fence creation to keep a correct reference accounting.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Fixes: 30cd85dd6edc ("dma-buf/sync_file: hold reference to fence when creating sync_file")
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Sumit Semwal Nov. 8, 2016, 7:32 p.m. UTC | #2
On 27 October 2016 at 03:24, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Wed, Oct 26, 2016 at 06:59:59PM -0200, Gustavo Padovan wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Once sw_sync_ioctl_create_fence() returns we no longer have the
>> *pt pointer to the fence base object thus we need to put the reference
>> we have from the fence creation to keep a correct reference accounting.
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Fixes: 30cd85dd6edc ("dma-buf/sync_file: hold reference to fence when creating sync_file")
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
>
Applied to drm-misc; Thanks!
> --
> Chris Wilson, Intel Open Source Technology Centre
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c
index 82e0ca4..efed2b7 100644
--- a/drivers/dma-buf/sw_sync.c
+++ b/drivers/dma-buf/sw_sync.c
@@ -316,8 +316,8 @@  static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
 	}
 
 	sync_file = sync_file_create(&pt->base);
+	dma_fence_put(&pt->base);
 	if (!sync_file) {
-		dma_fence_put(&pt->base);
 		err = -ENOMEM;
 		goto err;
 	}