diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-10 09:21:05 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-11 17:55:39 -0500 |
commit | 092de6f225638ec300936bfcbdc67805733cc78c (patch) | |
tree | 8abd0bf021c0dee7c4a55ee46ed58a65b68f8b0b /drivers | |
parent | 36cf17423095882ec0f8f2c04d1bd0ee812149df (diff) |
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
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 9 |
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 78b8cf90c922..3d39005540aa 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, | |||
127 | } | 127 | } |
128 | 128 | ||
129 | /* Nothing found, clean up and bail out! */ | 129 | /* Nothing found, clean up and bail out! */ |
130 | list_for_each_entry(obj, &unwind_list, exec_list) { | 130 | while (!list_empty(&unwind_list)) { |
131 | obj = list_first_entry(&unwind_list, | ||
132 | struct drm_i915_gem_object, | ||
133 | exec_list); | ||
134 | |||
131 | ret = drm_mm_scan_remove_block(obj->gtt_space); | 135 | ret = drm_mm_scan_remove_block(obj->gtt_space); |
132 | BUG_ON(ret); | 136 | BUG_ON(ret); |
137 | |||
138 | list_del_init(&obj->exec_list); | ||
133 | drm_gem_object_unreference(&obj->base); | 139 | drm_gem_object_unreference(&obj->base); |
134 | } | 140 | } |
135 | 141 | ||
@@ -162,6 +168,7 @@ found: | |||
162 | exec_list); | 168 | exec_list); |
163 | if (ret == 0) | 169 | if (ret == 0) |
164 | ret = i915_gem_object_unbind(obj); | 170 | ret = i915_gem_object_unbind(obj); |
171 | |||
165 | list_del_init(&obj->exec_list); | 172 | list_del_init(&obj->exec_list); |
166 | drm_gem_object_unreference(&obj->base); | 173 | drm_gem_object_unreference(&obj->base); |
167 | } | 174 | } |