diff options
author | Chris Wilson | 2010-10-29 11:41:23 +0200 |
---|---|---|
committer | Chris Wilson | 2010-10-29 11:54:29 +0200 |
commit | 7465378fd7c681f6cf2b74b3494c4f0991d8c8ac (patch) | |
tree | fb6266fb46cf3407792b361add7df31cb13588b5 /drivers/gpu/drm/i915/i915_gem.c | |
parent | drm/i915: Do not return -1 from shrinker when nr_to_scan == 0 (diff) | |
download | kernel-qcow2-linux-7465378fd7c681f6cf2b74b3494c4f0991d8c8ac.tar.gz kernel-qcow2-linux-7465378fd7c681f6cf2b74b3494c4f0991d8c8ac.tar.xz kernel-qcow2-linux-7465378fd7c681f6cf2b74b3494c4f0991d8c8ac.zip |
drm/i915: Convert BUG_ON(pin_count) from an impossible condition
Also spotted by Dan Carpenter.
obj->pin_count is unsigned so the BUG_ON(obj->pin_count<0) will never
trigger.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 7569b77fb403..08f57aedaf51 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4128,12 +4128,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment, return ret; } - obj_priv->pin_count++; - - /* If the object is not active and not pending a flush, - * remove it from the inactive list - */ - if (obj_priv->pin_count == 1) { + if (obj_priv->pin_count++ == 0) { i915_gem_info_add_pin(dev_priv, obj, mappable); if (!obj_priv->active) list_move_tail(&obj_priv->mm_list, @@ -4153,15 +4148,10 @@ i915_gem_object_unpin(struct drm_gem_object *obj) struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); WARN_ON(i915_verify_lists(dev)); - obj_priv->pin_count--; - BUG_ON(obj_priv->pin_count < 0); + BUG_ON(obj_priv->pin_count == 0); BUG_ON(obj_priv->gtt_space == NULL); - /* If the object is no longer pinned, and is - * neither active nor being flushed, then stick it on - * the inactive list - */ - if (obj_priv->pin_count == 0) { + if (--obj_priv->pin_count == 0) { if (!obj_priv->active) list_move_tail(&obj_priv->mm_list, &dev_priv->mm.inactive_list); |