提交 04c8f2bf 编写于 作者: J Jeeja KP 提交者: Mark Brown

ASoC: hdac_hdmi: avoid reference to invalid variable of the pin list

Using pin list array iterator outside the iteration of the list can
point to dummy element, which can be invalid. So don't use pin variable
outside the pin list iteration.

This fixes the following coccinelle warning:
sound/soc/codecs/hdac_hdmi.c:1419:5-8: ERROR: invalid reference to the
index variable of the iterator

Fixes: 2acd8309('ASoC: hdac_hdmi: Add support to handle MST capable pin')
Reported-by: NJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: NJeeja KP <jeeja.kp@intel.com>
Acked-by: NVinod Koul <vinod.koul@intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 c1ae3cfa
...@@ -1534,21 +1534,20 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) ...@@ -1534,21 +1534,20 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
pin->mst_capable = false; pin->mst_capable = false;
/* if not MST, default is port[0] */ /* if not MST, default is port[0] */
hport = &pin->ports[0]; hport = &pin->ports[0];
goto out;
} else { } else {
for (i = 0; i < pin->num_ports; i++) { for (i = 0; i < pin->num_ports; i++) {
pin->mst_capable = true; pin->mst_capable = true;
if (pin->ports[i].id == pipe) { if (pin->ports[i].id == pipe) {
hport = &pin->ports[i]; hport = &pin->ports[i];
goto out; break;
} }
} }
} }
if (hport)
hdac_hdmi_present_sense(pin, hport);
} }
out:
if (pin && hport)
hdac_hdmi_present_sense(pin, hport);
} }
static struct i915_audio_component_audio_ops aops = { static struct i915_audio_component_audio_ops aops = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册