Commit 2fe42dd0 authored by Jeeja KP's avatar Jeeja KP Committed by Mark Brown

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: e0e5d3e5('ASoC: hdac_hdmi: Add support for multiple ports to a PCM')
Reported-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJeeja KP <jeeja.kp@intel.com>
Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 04c8f2bf
...@@ -1997,7 +1997,7 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) ...@@ -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_pin *pin, *pin_next;
struct hdac_hdmi_cvt *cvt, *cvt_next; struct hdac_hdmi_cvt *cvt, *cvt_next;
struct hdac_hdmi_pcm *pcm, *pcm_next; struct hdac_hdmi_pcm *pcm, *pcm_next;
struct hdac_hdmi_port *port; struct hdac_hdmi_port *port, *port_next;
int i; int i;
snd_soc_unregister_codec(&edev->hdac.dev); snd_soc_unregister_codec(&edev->hdac.dev);
...@@ -2007,8 +2007,9 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) ...@@ -2007,8 +2007,9 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
if (list_empty(&pcm->port_list)) if (list_empty(&pcm->port_list))
continue; continue;
list_for_each_entry(port, &pcm->port_list, head) list_for_each_entry_safe(port, port_next,
port = NULL; &pcm->port_list, head)
list_del(&port->head);
list_del(&pcm->head); list_del(&pcm->head);
kfree(pcm); kfree(pcm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment