public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items
@ 2019-04-29 12:37 Wei Yongjun
  2019-04-30  3:05 ` Baolin Wang
  2019-05-02  2:18 ` Applied "ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-04-29 12:37 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: Wei Yongjun, alsa-devel, linux-kernel, kernel-janitors

Since we will remove items off the list using list_del() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Fixes: d7bff893e04f ("ASoC: sprd: Add Spreadtrum multi-channel data transfer support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 sound/soc/sprd/sprd-mcdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sprd/sprd-mcdt.c b/sound/soc/sprd/sprd-mcdt.c
index 28f5e649733d..df250f7f2b6f 100644
--- a/sound/soc/sprd/sprd-mcdt.c
+++ b/sound/soc/sprd/sprd-mcdt.c
@@ -978,12 +978,12 @@ static int sprd_mcdt_probe(struct platform_device *pdev)
 
 static int sprd_mcdt_remove(struct platform_device *pdev)
 {
-	struct sprd_mcdt_chan *temp;
+	struct sprd_mcdt_chan *chan, *temp;
 
 	mutex_lock(&sprd_mcdt_list_mutex);
 
-	list_for_each_entry(temp, &sprd_mcdt_chan_list, list)
-		list_del(&temp->list);
+	list_for_each_entry_safe(chan, temp, &sprd_mcdt_chan_list, list)
+		list_del(&chan->list);
 
 	mutex_unlock(&sprd_mcdt_list_mutex);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-02  2:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-29 12:37 [PATCH -next] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items Wei Yongjun
2019-04-30  3:05 ` Baolin Wang
2019-05-02  2:18 ` Applied "ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox