提交 e93daed8 编写于 作者: T Thomas Hellstrom 提交者: Dave Airlie

vmwgfx: Allow reference and unreference of NULL fence objects.

The execbuf utils may call reference on NULL fence objects.
Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: NJakob Bornecrantz <jakob@vmware.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册