drm/gem: WARN about unbalanced handle refcounts
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 14 Aug 2013 22:02:36 +0000 (00:02 +0200)
committerDave Airlie <airlied@redhat.com>
Mon, 19 Aug 2013 00:47:37 +0000 (10:47 +1000)
Trying to drop a reference we don't have is a pretty serious bug.
Trying to paper over it is an even worse offense.

So scream into dmesg with a big WARN in case that ever happens.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_gem.c

index 44978bc..dcbd2f5 100644 (file)
@@ -238,7 +238,7 @@ static void drm_gem_object_handle_free(struct drm_gem_object *obj)
 void
 drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
 {
-       if (atomic_read(&obj->handle_count) == 0)
+       if (WARN_ON(atomic_read(&obj->handle_count) == 0))
                return;
 
        /*