[Intel-gfx] [PATCH] Fix list empty check in i915_gem_evict_everything

Zhiyuan Lv zhiyuan.lv at intel.com
Wed Aug 26 00:01:26 PDT 2015


That seems to be a typo. The original code will override the previous
list empty check value in the loop. As the result, only the last vm in
vm_list impacts the empty check. The problem is fixed by using local
bool variable inside the loop.

Signed-off-by: Zhiyuan Lv <zhiyuan.lv at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_evict.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
index d09e35e..a45cffa 100644
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
@@ -255,10 +255,12 @@ i915_gem_evict_everything(struct drm_device *dev)
 	int ret;
 
 	list_for_each_entry(vm, &dev_priv->vm_list, global_link) {
-		lists_empty = (list_empty(&vm->inactive_list) &&
+		bool empty = (list_empty(&vm->inactive_list) &&
 			       list_empty(&vm->active_list));
-		if (!lists_empty)
+		if (!empty) {
 			lists_empty = false;
+			break;
+		}
 	}
 
 	if (lists_empty)
-- 
1.9.1



More information about the Intel-gfx mailing list