Skip to contentSkip to conversation

i915: fix impossible BUG_ON() test

PATCH In review Dan Carpenter 2 participants 2 messages Oct 27, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i915: fix impossible BUG_ON() test

obj_priv->pin_count is unsigned so the BUG_ON(obj_priv->pin_count < 0) will never trigger.

drivers/gpu/drm/i915/i915_gem.c +3 -2
index 8eb8453..151d9c8 100644
@@ -4082,10 +4082,11 @@ 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);
 
+	obj_priv->pin_count--;
+
 	/* If the object is no longer pinned, and is
 	 * neither active nor being flushed, then stick it on
 	 * the inactive list
#1 lore raw
Quoted 2 lines · Dan Carpenter

obj_priv->pin_count is unsigned so the BUG_ON(obj_priv->pin_count < 0) will never trigger.

I have the same change pending, but not queued for -fixes since it is impossible.

Thanks,
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre