diff options
author | Jeeja KP <jeeja.kp@intel.com> | 2017-03-01 20:11:24 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-03-06 13:42:34 +0300 |
commit | 2fe42dd0f13812d38daaf05bcb1fd996afd0e87a (patch) | |
tree | 1e71dc34ef66c24b44bb7da88a1f84cb81bb0e7f /sound/soc | |
parent | 04c8f2bf9117de7b8e8bc0b90e8c4bff15f4f613 (diff) | |
download | linux-2fe42dd0f13812d38daaf05bcb1fd996afd0e87a.tar.xz |
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: e0e5d3e5a53b('ASoC: hdac_hdmi: Add support for multiple ports to a PCM')
Reported-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/hdac_hdmi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index bb405698e102..fd272a40485b 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1997,7 +1997,7 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) struct hdac_hdmi_pin *pin, *pin_next; struct hdac_hdmi_cvt *cvt, *cvt_next; struct hdac_hdmi_pcm *pcm, *pcm_next; - struct hdac_hdmi_port *port; + struct hdac_hdmi_port *port, *port_next; int i; snd_soc_unregister_codec(&edev->hdac.dev); @@ -2007,8 +2007,9 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) if (list_empty(&pcm->port_list)) continue; - list_for_each_entry(port, &pcm->port_list, head) - port = NULL; + list_for_each_entry_safe(port, port_next, + &pcm->port_list, head) + list_del(&port->head); list_del(&pcm->head); kfree(pcm); |