summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-01-10 14:21:05 (GMT)
committerChris Wilson <chris@chris-wilson.co.uk>2011-01-11 22:55:39 (GMT)
commit092de6f225638ec300936bfcbdc67805733cc78c (patch)
tree8abd0bf021c0dee7c4a55ee46ed58a65b68f8b0b
parent36cf17423095882ec0f8f2c04d1bd0ee812149df (diff)
downloadlinux-092de6f225638ec300936bfcbdc67805733cc78c.tar.xz
drm/i915/evict: Ensure we completely cleanup on failure
... and not leave the objects in a inconsistent state. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: stable@kernel.org
-rw-r--r--drivers/gpu/drm/i915/i915_gem_evict.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index 78b8cf9..3d39005 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -127,9 +127,15 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
}
/* Nothing found, clean up and bail out! */
- list_for_each_entry(obj, &unwind_list, exec_list) {
+ while (!list_empty(&unwind_list)) {
+ obj = list_first_entry(&unwind_list,
+ struct drm_i915_gem_object,
+ exec_list);
+
ret = drm_mm_scan_remove_block(obj->gtt_space);
BUG_ON(ret);
+
+ list_del_init(&obj->exec_list);
drm_gem_object_unreference(&obj->base);
}
@@ -162,6 +168,7 @@ found:
exec_list);
if (ret == 0)
ret = i915_gem_object_unbind(obj);
+
list_del_init(&obj->exec_list);
drm_gem_object_unreference(&obj->base);
}