alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: hdac_hdmi: avoid reference to invalid variable of the pin list
@ 2017-03-01 17:11 jeeja.kp
  2017-03-01 17:11 ` [PATCH 2/2] ASoC: hdac_hdmi: don't update the iterator in pcm list remove jeeja.kp
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: jeeja.kp @ 2017-03-01 17:11 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, patches.audio, broonie, liam.r.girdwood, Jeeja KP

From: Jeeja KP <jeeja.kp@intel.com>

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: 2acd8309a3a4('ASoC: hdac_hdmi: Add support to handle MST capable pin')
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/codecs/hdac_hdmi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 78fca8a..bb40569 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -1534,21 +1534,20 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
 			pin->mst_capable = false;
 			/* if not MST, default is port[0] */
 			hport = &pin->ports[0];
-			goto out;
 		} else {
 			for (i = 0; i < pin->num_ports; i++) {
 				pin->mst_capable = true;
 				if (pin->ports[i].id == pipe) {
 					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 = {
-- 
2.5.0

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

end of thread, other threads:[~2017-03-06 10:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-01 17:11 [PATCH 1/2] ASoC: hdac_hdmi: avoid reference to invalid variable of the pin list jeeja.kp
2017-03-01 17:11 ` [PATCH 2/2] ASoC: hdac_hdmi: don't update the iterator in pcm list remove jeeja.kp
2017-03-06 10:46   ` Applied "ASoC: hdac_hdmi: don't update the iterator in pcm list remove" to the asoc tree Mark Brown
2017-03-02  8:52 ` [PATCH 1/2] ASoC: hdac_hdmi: avoid reference to invalid variable of the pin list Vinod Koul
2017-03-06 10:46 ` Applied "ASoC: hdac_hdmi: avoid reference to invalid variable of the pin list" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).