Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S980460AbdDYD65 (ORCPT ); Mon, 24 Apr 2017 23:58:57 -0400 Received: from mga07.intel.com ([134.134.136.100]:37078 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S980131AbdDYD6u (ORCPT ); Mon, 24 Apr 2017 23:58:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,247,1488873600"; d="scan'208";a="1139731843" Date: Tue, 25 Apr 2017 09:30:35 +0530 From: Vinod Koul To: Wei Yongjun Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pardha Saradhi K , G Kranthi , Hardik T Shah , Jeeja KP , Wei Yongjun , 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 Message-ID: <20170425040035.GY6263@localhost> References: <20170425032817.21959-1-weiyj.lk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170425032817.21959-1-weiyj.lk@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2469 Lines: 66 On Tue, Apr 25, 2017 at 03:28:17AM +0000, Wei Yongjun wrote: > From: 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() 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 > --- > 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