summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-05-21 15:15:58 -0700
committerEric Anholt <eric@anholt.net>2008-05-21 15:15:58 -0700
commit54fa32cdfe1529023324a0a261ee5d4e033f46ea (patch)
treea19011e6613ead555e3e541c93488b8f1ac38c49 /linux-core
parent7078978db0e014a2621984f6c67ca65fa4f23f3a (diff)
[gem] Fix bad test for list_for_each completion.
Since it's a circular list, the entry won't be NULL at termination.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/i915_gem.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c
index e01823fb..94e2e477 100644
--- a/linux-core/i915_gem.c
+++ b/linux-core/i915_gem.c
@@ -478,14 +478,19 @@ i915_gem_evict_something(struct drm_device *dev)
struct drm_i915_gem_object,
list);
} else if (!list_empty(&dev_priv->mm.active_list)) {
+ int found = 0;
+
/* If there's nothing unused and ready, grab the first
* unpinned object from the currently executing list.
*/
list_for_each_entry(obj_priv, &dev_priv->mm.active_list,
- list)
- if (obj_priv->pin_count == 0)
+ list) {
+ if (obj_priv->pin_count == 0) {
+ found = 1;
break;
- if (!obj_priv)
+ }
+ }
+ if (!found)
return -ENOMEM;
} else {
return -ENOMEM;