Skip to content

Commit 2fe42dd

Browse files
kpjeejabroonie
authored andcommitted
ASoC: hdac_hdmi: don't update the iterator in pcm list remove
Fix not to update the iterator element, instead use list_del to remove entry from the list. This fixes the following coccinelle and static checker warning: sound/soc/codecs/hdac_hdmi.c:1884:2-21:iterator with update on line 1885 sound/soc/codecs/hdac_hdmi.c:2011 hdac_hdmi_dev_remove() error: potential NULL dereference 'port'. Fixes: e0e5d3e('ASoC: hdac_hdmi: Add support for multiple ports to a PCM') Reported-by: Julia Lawall <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Jeeja KP <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 04c8f2b commit 2fe42dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/codecs/hdac_hdmi.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
19971997
struct hdac_hdmi_pin *pin, *pin_next;
19981998
struct hdac_hdmi_cvt *cvt, *cvt_next;
19991999
struct hdac_hdmi_pcm *pcm, *pcm_next;
2000-
struct hdac_hdmi_port *port;
2000+
struct hdac_hdmi_port *port, *port_next;
20012001
int i;
20022002

20032003
snd_soc_unregister_codec(&edev->hdac.dev);
@@ -2007,8 +2007,9 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
20072007
if (list_empty(&pcm->port_list))
20082008
continue;
20092009

2010-
list_for_each_entry(port, &pcm->port_list, head)
2011-
port = NULL;
2010+
list_for_each_entry_safe(port, port_next,
2011+
&pcm->port_list, head)
2012+
list_del(&port->head);
20122013

20132014
list_del(&pcm->head);
20142015
kfree(pcm);

0 commit comments

Comments
 (0)