Skip to content

Commit

Permalink
drm/i915/evict: Ensure we completely cleanup on failure
Browse files Browse the repository at this point in the history
... and not leave the objects in a inconsistent state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
  • Loading branch information
Chris Wilson committed Jan 11, 2011
1 parent 36cf174 commit 092de6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/gpu/drm/i915/i915_gem_evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -162,6 +168,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
exec_list);
if (ret == 0)
ret = i915_gem_object_unbind(obj);

list_del_init(&obj->exec_list);
drm_gem_object_unreference(&obj->base);
}
Expand Down

0 comments on commit 092de6f

Please sign in to comment.