public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
	G Kranthi <gudishax.kranthikumar@intel.com>,
	Hardik T Shah <hardik.t.shah@intel.com>,
	Jeeja KP <jeeja.kp@intel.com>,
	Wei Yongjun <weiyongjun1@huawei.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items
Date: Tue, 25 Apr 2017 09:30:35 +0530	[thread overview]
Message-ID: <20170425040035.GY6263@localhost> (raw)
In-Reply-To: <20170425032817.21959-1-weiyj.lk@gmail.com>

On Tue, Apr 25, 2017 at 03:28:17AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Since we will remove items off the list using list_del() we need
> to use a safe version of the list_for_each() macro aptly named
> list_for_each_safe().

ah yes, god catch

> This is detected by Coccinelle semantic patch.

It is a good practice to include the script you used, do you mind adding
that in the log?

> 
> Fixes: b8c722ddd548 ("ASoC: Intel: Skylake: Add support for deferred
> DSP module bind")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  sound/soc/intel/skylake/skl-pcm.c | 4 ++--
>  sound/soc/intel/skylake/skl-topology.c | 4 ++--
>  2 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
> index 600faad..d43d197 100644
> --- a/sound/soc/intel/skylake/skl-pcm.c
> +++ b/sound/soc/intel/skylake/skl-pcm.c
> @@ -1323,10 +1323,10 @@ int skl_platform_unregister(struct device *dev)
>  {
>  	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
>  	struct skl *skl = ebus_to_skl(ebus);
> -	struct skl_module_deferred_bind *modules;
> +	struct skl_module_deferred_bind *modules, *tmp;
>  
>  	if (!list_empty(&skl->bind_list)) {
> -		list_for_each_entry(modules, &skl->bind_list, node) {
> +		list_for_each_entry_safe(modules, tmp, &skl->bind_list, node) {
>  			list_del(&modules->node);
>  			kfree(modules);
>  		}
> diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
> index 74b3acf..aea7917 100644
> --- a/sound/soc/intel/skylake/skl-topology.c
> +++ b/sound/soc/intel/skylake/skl-topology.c
> @@ -1091,7 +1091,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
>  	struct skl_module_cfg *src_module = NULL, *dst_module;
>  	struct skl_sst *ctx = skl->skl_sst;
>  	struct skl_pipe *s_pipe = mconfig->pipe;
> -	struct skl_module_deferred_bind *modules;
> +	struct skl_module_deferred_bind *modules, *tmp;
>  
>  	if (s_pipe->state == SKL_PIPE_INVALID)
>  		return -EINVAL;
> @@ -1105,7 +1105,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
>  
>  		src_module = w_module->w->priv;
>  
> -		list_for_each_entry(modules, &skl->bind_list, node) {
> +		list_for_each_entry_safe(modules, tmp, &skl->bind_list, node) {
>  			/*
>  			 * When the destination module is deleted, Unbind the
>  			 * modules from deferred bind list.
> 

-- 
~Vinod

  reply	other threads:[~2017-04-25  3:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  3:28 [PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items Wei Yongjun
2017-04-25  4:00 ` Vinod Koul [this message]
2017-04-25  7:57   ` weiyongjun (A)
2017-04-26  5:38     ` Vinod Koul
2017-04-26  5:39       ` weiyongjun (A)
2017-04-28  8:06       ` weiyongjun (A)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170425040035.GY6263@localhost \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gudishax.kranthikumar@intel.com \
    --cc=hardik.t.shah@intel.com \
    --cc=jeeja.kp@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pardha.saradhi.kesapragada@intel.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=weiyj.lk@gmail.com \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox