playback: kill a infinite loop in pcm_param

Don't delete item with list_for_item. with list_for_item, a item
is deleted from list but the next of this item is used to visit
the list.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
This commit is contained in:
Rander Wang 2018-09-10 12:55:36 +08:00 committed by Pan Xiuli
parent bc96f88e65
commit 1ff4a9df32
1 changed files with 6 additions and 5 deletions

View File

@ -167,7 +167,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
struct sof_ipc_comp_host *host = NULL;
struct list_item elem_list;
struct dma_sg_elem *elem;
struct list_item *plist;
struct list_item *clist;
struct list_item *tlist;
uint32_t ring_size;
#endif
struct sof_ipc_pcm_params *pcm_params = _ipc->comp_data;
@ -233,8 +234,8 @@ static int ipc_stream_pcm_params(uint32_t stream)
goto error;
}
list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);
err = comp_host_buffer(cd, elem, ring_size);
if (err < 0) {
@ -279,8 +280,8 @@ pipe_params:
error:
#ifdef CONFIG_HOST_PTABLE
list_for_item(plist, &elem_list) {
elem = container_of(plist, struct dma_sg_elem, list);
list_for_item_safe(clist, tlist, &elem_list) {
elem = container_of(clist, struct dma_sg_elem, list);
list_item_del(&elem->list);
rfree(elem);
}