[PATCH] drm/i915/gt: Add GEM_BUG_ON to ensure at least one engine supports migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Apoorva Singh <apoorva.singh@xxxxxxxxx>

Ensure GEM_BUG_ON verifies at least one engine supports migration.
Additionally, it prevents passing an uninitialized variable to
intel_context_create().

Cc: Chris Wilson <chris.p.wilson@xxxxxxxxxxxxxxx>
Signed-off-by: Apoorva Singh <apoorva.singh@xxxxxxxxx>
---
 drivers/gpu/drm/i915/gt/intel_migrate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
index 6f7af4077135..528a7cba3623 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -296,6 +296,9 @@ static struct intel_context *__migrate_engines(struct intel_gt *gt)
 			engines[count++] = engine;
 	}
 
+	/* At least one engine must support migration! */
+	GEM_BUG_ON(!count);
+
 	return intel_context_create(engines[random_index(count)]);
 }
 
-- 
2.34.1




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux