drm/i915/audio: fix check for av_enc_map overflow
authorJani Nikula <jani.nikula@intel.com>
Wed, 14 Feb 2018 17:38:40 +0000 (19:38 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 15 Feb 2018 14:29:13 +0000 (16:29 +0200)
commitcdb3db8542d854bd678d60cd28861b042e191672
treed32160387b13f7180188066148fdace870d27162
parentccf74400da4d7c94307ac24e7398337d9c4312d9
drm/i915/audio: fix check for av_enc_map overflow

Turns out -1 >= ARRAY_SIZE() is always true. Move the bounds check where
we know pipe >= 0 and next to the array indexing where it makes most
sense.

Fixes: 9965db26ac05 ("drm/i915: Check for fused or unused pipes")
Fixes: 0b7029b7e43f ("drm/i915: Check for fused or unused pipes")
Cc: <stable@vger.kernel.org> # v4.10+
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180214173840.25360-1-jani.nikula@intel.com
drivers/gpu/drm/i915/intel_audio.c