summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-10-04 20:13:29 +0200
committerDave Airlie <airlied@redhat.com>2011-10-05 10:17:21 +0100
commite93daed8e2fd5ce3dc98efe9938426127a534ccc (patch)
tree17414286b33992253ddbe04bd84c797342af01f8 /drivers
parentb37a6b9ad002a6c123a6924668dfef5c5fb0b700 (diff)
downloadblackbird-op-linux-e93daed8e2fd5ce3dc98efe9938426127a534ccc.tar.gz
blackbird-op-linux-e93daed8e2fd5ce3dc98efe9938426127a534ccc.zip
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')
-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:
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);
OpenPOWER on IntegriCloud