Skip to content

Commit 04c8f2b

Browse files
kpjeejabroonie
authored andcommitted
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: 2acd830('ASoC: hdac_hdmi: Add support to handle MST capable pin') Reported-by: Julia Lawall <[email protected]> Signed-off-by: Jeeja KP <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent c1ae3cf commit 04c8f2b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sound/soc/codecs/hdac_hdmi.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,21 +1534,20 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
15341534
pin->mst_capable = false;
15351535
/* if not MST, default is port[0] */
15361536
hport = &pin->ports[0];
1537-
goto out;
15381537
} else {
15391538
for (i = 0; i < pin->num_ports; i++) {
15401539
pin->mst_capable = true;
15411540
if (pin->ports[i].id == pipe) {
15421541
hport = &pin->ports[i];
1543-
goto out;
1542+
break;
15441543
}
15451544
}
15461545
}
1546+
1547+
if (hport)
1548+
hdac_hdmi_present_sense(pin, hport);
15471549
}
15481550

1549-
out:
1550-
if (pin && hport)
1551-
hdac_hdmi_present_sense(pin, hport);
15521551
}
15531552

15541553
static struct i915_audio_component_audio_ops aops = {

0 commit comments

Comments
 (0)