Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e93daed8 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie
Browse files

vmwgfx: Allow reference and unreference of NULL fence objects.



The execbuf utils may call reference on NULL fence objects.

Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarJakob Bornecrantz <jakob@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent b37a6b9a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -177,6 +177,9 @@ static int vmw_fence_obj_init(struct vmw_fence_manager *fman,

struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence)
{
	if (unlikely(fence == NULL))
		return NULL;

	kref_get(&fence->kref);
	return fence;
}
@@ -191,8 +194,12 @@ struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence)
void vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
{
	struct vmw_fence_obj *fence = *fence_p;
	struct vmw_fence_manager *fman = fence->fman;
	struct vmw_fence_manager *fman;

	if (unlikely(fence == NULL))
		return;

	fman = fence->fman;
	*fence_p = NULL;
	spin_lock_irq(&fman->lock);
	BUG_ON(atomic_read(&fence->kref.refcount) == 0);