drm/i915: Check for fused or unused pipes
authorMika Kahola <[email protected]>
Mon, 18 Dec 2017 08:04:03 +0000 (10:04 +0200)
committerJani Nikula <[email protected]>
Fri, 19 Jan 2018 14:15:50 +0000 (16:15 +0200)
We may have fused or unused pipes in our system. Let's check that the pipe
in question is within limits of accessible pipes. In case, that we are not
able to access the pipe, we return early with a warning.

v2: Rephrasing of the commit message (Jani)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103206
Reported-by: Thomas Gleixner <[email protected]>
Tested-by: Jaswinder Singh Rajput <[email protected]>
Suggested-by: Jani Nikula <[email protected]>
Reviewed-by: Jani Nikula <[email protected]>
Signed-off-by: Mika Kahola <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/i915/intel_audio.c

index f1502a0188eb23e51a746b4f6bbedaecf3167ad1..522d54fecb53489193eb2b72dbf9fdd41009ac67 100644 (file)
@@ -779,7 +779,7 @@ static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv,
 {
        struct intel_encoder *encoder;
 
-       if (WARN_ON(pipe >= INTEL_INFO(dev_priv)->num_pipes))
+       if (WARN_ON(pipe >= ARRAY_SIZE(dev_priv->av_enc_map)))
                return NULL;
 
        /* MST */