Skip to contentSkip to conversation

ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items

PATCH In review Wei Yongjun 3 participants 3 messages Apr 29, 2019 – May 2, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items

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")
---
 sound/soc/sprd/sprd-mcdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/sprd/sprd-mcdt.c +3 -3
index 28f5e649733d..df250f7f2b6f 100644
@@ -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);
 
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 7 lines · Wei Yongjun

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")

Yes, thanks for your fixes.

Quoted 26 lines
---
 sound/soc/sprd/sprd-mcdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/sprd/sprd-mcdt.c +3 -3
index 28f5e649733d..df250f7f2b6f 100644
@@ -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);
 
Signature · 2 lines
Baolin Wang
Best Regards
maintainer
#2 lore raw

Applied "ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items" to the asoc tree

In reply to Wei Yongjun

The patch

ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 81a812c98b6eda7e3101305d57354433e3edc541 Mon Sep 17 00:00:00 2001

From: Wei Yongjun <[email protected]>
Date: Mon, 29 Apr 2019 12:37:13 +0000
Subject: [PATCH] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete
items

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")
---
 sound/soc/sprd/sprd-mcdt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/sprd/sprd-mcdt.c +3 -3
index e9318d7a4810..7448015a4935 100644
@@ -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);
 
Signature · 1 line
2.20.1