[igt-dev] [PATCH i-g-t] lib/i915: Fix is_physical_engine advancement

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 29 12:16:02 UTC 2020


Update the local var e after iterating to the next engine when searching
for the next non-virtual engine. Otherwise, it is prone to loop forever.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Andi Shyti <andi.shyti at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
---
 lib/i915/gem_engine_topology.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
index 43a99e0ff..9daa03df4 100644
--- a/lib/i915/gem_engine_topology.c
+++ b/lib/i915/gem_engine_topology.c
@@ -180,10 +180,8 @@ intel_get_current_physical_engine(struct intel_engine_data *ed)
 {
 	struct intel_execution_engine2 *e;
 
-	for (e = intel_get_current_engine(ed);
-	     e && e->is_virtual;
-	     intel_next_engine(ed))
-		;
+	while ((e = intel_get_current_engine(ed)) && e->is_virtual)
+	     intel_next_engine(ed);
 
 	return e;
 }
-- 
2.25.0



More information about the igt-dev mailing list