All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Use BUILD_BUG_ON to detected missing engine definitions
@ 2017-02-28 14:00 Michal Wajdeczko
  2017-02-28 14:07 ` Joonas Lahtinen
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Michal Wajdeczko @ 2017-02-28 14:00 UTC (permalink / raw)
  To: intel-gfx

Additionally use runtime check to catch invalid engine indices.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index a238304..8df53ae 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -89,6 +89,8 @@ intel_engine_setup(struct drm_i915_private *dev_priv,
 	const struct engine_info *info = &intel_engines[id];
 	struct intel_engine_cs *engine;
 
+	BUILD_BUG_ON(ARRAY_SIZE(intel_engines) != I915_NUM_ENGINES);
+	GEM_BUG_ON(id < 0 || id >= I915_NUM_ENGINES);
 	GEM_BUG_ON(dev_priv->engine[id]);
 	engine = kzalloc(sizeof(*engine), GFP_KERNEL);
 	if (!engine)
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-02-28 17:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 14:00 [PATCH] drm/i915: Use BUILD_BUG_ON to detected missing engine definitions Michal Wajdeczko
2017-02-28 14:07 ` Joonas Lahtinen
2017-02-28 14:12 ` Chris Wilson
2017-02-28 14:18   ` Chris Wilson
2017-02-28 14:29   ` Michal Wajdeczko
2017-02-28 14:21 ` Tvrtko Ursulin
2017-02-28 14:31   ` Joonas Lahtinen
2017-02-28 14:52   ` Michal Wajdeczko
2017-02-28 15:04     ` Tvrtko Ursulin
2017-02-28 15:08     ` Chris Wilson
2017-02-28 16:36       ` Michal Wajdeczko
2017-02-28 17:53 ` ✗ Fi.CI.BAT: failure for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.