From: Ville Syrjälä <[email protected]>

Sprinkle in some BUILD_BUG_ON()s to make sure some of
the bitmasks used in the device info have enough bits.

Do we have a better place for this sort of stuff?

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_device_info.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_device_info.c 
b/drivers/gpu/drm/i915/intel_device_info.c
index 4ef7dd1d3bbe..70846e5d9a33 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -406,8 +406,12 @@ void intel_device_info_runtime_init(struct 
drm_i915_private *dev_priv)
        struct intel_device_info *info = mkwrite_device_info(dev_priv);
        struct intel_runtime_info *runtime = RUNTIME_INFO(dev_priv);
        enum pipe pipe;
 
+       BUILD_BUG_ON(BITS_PER_TYPE(runtime->pipe_mask) < I915_MAX_PIPES);
+       BUILD_BUG_ON(BITS_PER_TYPE(runtime->cpu_transcoder_mask) < 
I915_MAX_TRANSCODERS);
+       BUILD_BUG_ON(BITS_PER_TYPE(runtime->port_mask) < I915_MAX_PORTS);
+
        /* Wa_14011765242: adl-s A0,A1 */
        if (IS_ADLS_DISPLAY_STEP(dev_priv, STEP_A0, STEP_A2))
                for_each_pipe(dev_priv, pipe)
                        runtime->num_scalers[pipe] = 0;
-- 
2.39.2

Reply via email to