2019-04-29 12:29:46

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] 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")
Signed-off-by: Wei Yongjun <[email protected]>
---
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);




2019-04-30 03:06:32

by Baolin Wang

[permalink] [raw]
Subject: Re: [PATCH -next] ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items

Hi,

On Mon, 29 Apr 2019 at 20:27, Wei Yongjun <[email protected]> wrote:
>
> 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 <[email protected]>

Yes, thanks for your fixes.
Reviewed-by: Baolin Wang <[email protected]>

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


--
Baolin Wang
Best Regards

2019-05-02 02:19:34

by Mark Brown

[permalink] [raw]
Subject: Applied "ASoC: sprd: Fix to use list_for_each_entry_safe() when delete items" to the asoc tree

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

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")
Signed-off-by: Wei Yongjun <[email protected]>
Reviewed-by: Baolin Wang <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
---
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 e9318d7a4810..7448015a4935 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);

--
2.20.1