All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: "weiyongjun (A)" <weiyongjun1@huawei.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Wei Yongjun <weiyj.lk@gmail.com>,
	Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	G Kranthi <gudishax.kranthikumar@intel.com>,
	Mark Brown <broonie@kernel.org>,
	Hardik T Shah <hardik.t.shah@intel.com>,
	Jeeja KP <jeeja.kp@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items
Date: Wed, 26 Apr 2017 11:08:03 +0530	[thread overview]
Message-ID: <20170426053803.GE6263@localhost> (raw)
In-Reply-To: <6AADFAC011213A4C87B956458587ADB47BD834@SZXEMI508-MBX.china.huawei.com>

On Tue, Apr 25, 2017 at 07:57:57AM +0000, weiyongjun (A) wrote:
> > >
> > > 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?
> > 
> 
> Sure. 

Sorry I meant this should be in changelog of the patch :)

> 
> @@
> iterator name list_for_each;
> expression E;
> expression pos, head;
> identifier l;
> @@
> *  list_for_each(pos, head)
> {
> ...
> *  \(list_del\|list_del_init\|list_move\|list_move_tail\)(pos, ...);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> expression E;
> expression pos, head, ep;
> identifier list;
> identifier l;
> @@
> *  list_for_each(pos, head)
> {
> ...
> * ep = list_entry(pos, ..., list);
> ...
> *  \(list_del\|list_del_init\|list_move\|list_move_tail\)(&ep->list, ...);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_prev;
> expression E;
> expression pos, head;
> identifier l;
> @@
> *  list_for_each_prev(pos, head)
> {
> ...
> *  \(list_del\|list_del_init\)(pos);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry_from;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry_from(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry_reverse;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry_reverse(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: "weiyongjun (A)" <weiyongjun1@huawei.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>,
	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>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items
Date: Wed, 26 Apr 2017 11:08:03 +0530	[thread overview]
Message-ID: <20170426053803.GE6263@localhost> (raw)
In-Reply-To: <6AADFAC011213A4C87B956458587ADB47BD834@SZXEMI508-MBX.china.huawei.com>

On Tue, Apr 25, 2017 at 07:57:57AM +0000, weiyongjun (A) wrote:
> > >
> > > 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?
> > 
> 
> Sure. 

Sorry I meant this should be in changelog of the patch :)

> 
> @@
> iterator name list_for_each;
> expression E;
> expression pos, head;
> identifier l;
> @@
> *  list_for_each(pos, head)
> {
> ...
> *  \(list_del\|list_del_init\|list_move\|list_move_tail\)(pos, ...);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> expression E;
> expression pos, head, ep;
> identifier list;
> identifier l;
> @@
> *  list_for_each(pos, head)
> {
> ...
> * ep = list_entry(pos, ..., list);
> ...
> *  \(list_del\|list_del_init\|list_move\|list_move_tail\)(&ep->list, ...);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_prev;
> expression E;
> expression pos, head;
> identifier l;
> @@
> *  list_for_each_prev(pos, head)
> {
> ...
> *  \(list_del\|list_del_init\)(pos);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry_from;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry_from(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }
> 
> @@
> iterator name list_for_each_entry_reverse;
> expression E;
> expression pos, head;
> identifier l, member;
> @@
> 
> *  list_for_each_entry_reverse(pos, head, member)
> {
> ...
> *  \(list_del\|list_del_init\)(&pos->member);
> ... when != \(goto l; \| break; \| return E; \| return;\)
> }

-- 
~Vinod

  reply	other threads:[~2017-04-26  5:36 UTC|newest]

Thread overview: 10+ 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  3:28 ` Wei Yongjun
2017-04-25  4:00 ` Vinod Koul
2017-04-25  4:00   ` Vinod Koul
2017-04-25  7:57   ` weiyongjun (A)
2017-04-26  5:38     ` Vinod Koul [this message]
2017-04-26  5:38       ` Vinod Koul
2017-04-26  5:39       ` weiyongjun (A)
2017-04-28  8:06       ` 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=20170426053803.GE6263@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.