[Intel-gfx] [PATCH 4/4] Klock work Fix for uninitialized array intel_migrate.c

Bommu Krishnaiah krishnaiah.bommu at intel.com
Mon Jun 28 14:38:29 UTC 2021


Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_migrate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
index 23c59ce66cee5..5df7b8af6fdb9 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -208,11 +208,15 @@ static struct intel_context *__migrate_engines(struct intel_gt *gt)
 
 	count = 0;
 	for (i = 0; i < ARRAY_SIZE(gt->engine_class[COPY_ENGINE_CLASS]); i++) {
+
 		engine = gt->engine_class[COPY_ENGINE_CLASS][i];
 		if (engine_supports_migration(engine))
 			engines[count++] = engine;
 	}
 
+	if (count == 0)
+		return ERR_PTR(-ENXIO);
+
 	return intel_context_create(engines[random_index(count)]);
 }
 
-- 
2.25.1



More information about the Intel-gfx mailing list