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

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
...@@ -177,6 +177,9 @@ static int vmw_fence_obj_init(struct vmw_fence_manager *fman, ...@@ -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) struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence)
{ {
if (unlikely(fence == NULL))
return NULL;
kref_get(&fence->kref); kref_get(&fence->kref);
return fence; return fence;
} }
...@@ -191,8 +194,12 @@ struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *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) void vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
{ {
struct vmw_fence_obj *fence = *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; *fence_p = NULL;
spin_lock_irq(&fman->lock); spin_lock_irq(&fman->lock);
BUG_ON(atomic_read(&fence->kref.refcount) == 0); BUG_ON(atomic_read(&fence->kref.refcount) == 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment