aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-10-04 14:13:29 -0400
committerDave Airlie <airlied@redhat.com>2011-10-05 05:17:21 -0400
commite93daed8e2fd5ce3dc98efe9938426127a534ccc (patch)
tree17414286b33992253ddbe04bd84c797342af01f8 /drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
parentb37a6b9ad002a6c123a6924668dfef5c5fb0b700 (diff)
vmwgfx: Allow reference and unreference of NULL fence objects.
The execbuf utils may call reference on NULL fence objects. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_fence.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fence.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 5065a140fdf8..5f60be76166e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -177,6 +177,9 @@ out_unlock:
177 177
178struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence) 178struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence)
179{ 179{
180 if (unlikely(fence == NULL))
181 return NULL;
182
180 kref_get(&fence->kref); 183 kref_get(&fence->kref);
181 return fence; 184 return fence;
182} 185}
@@ -191,8 +194,12 @@ struct vmw_fence_obj *vmw_fence_obj_reference(struct vmw_fence_obj *fence)
191void vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p) 194void vmw_fence_obj_unreference(struct vmw_fence_obj **fence_p)
192{ 195{
193 struct vmw_fence_obj *fence = *fence_p; 196 struct vmw_fence_obj *fence = *fence_p;
194 struct vmw_fence_manager *fman = fence->fman; 197 struct vmw_fence_manager *fman;
198
199 if (unlikely(fence == NULL))
200 return;
195 201
202 fman = fence->fman;
196 *fence_p = NULL; 203 *fence_p = NULL;
197 spin_lock_irq(&fman->lock); 204 spin_lock_irq(&fman->lock);
198 BUG_ON(atomic_read(&fence->kref.refcount) == 0); 205 BUG_ON(atomic_read(&fence->kref.refcount) == 0);