Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1954167AbdDZFg0 (ORCPT ); Wed, 26 Apr 2017 01:36:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:55914 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752908AbdDZFgR (ORCPT ); Wed, 26 Apr 2017 01:36:17 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,253,1488873600"; d="scan'208";a="1140241898" Date: Wed, 26 Apr 2017 11:08:03 +0530 From: Vinod Koul To: "weiyongjun (A)" Cc: Wei Yongjun , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pardha Saradhi K , G Kranthi , Hardik T Shah , Jeeja KP , "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: <20170426053803.GE6263@localhost> References: <20170425032817.21959-1-weiyj.lk@gmail.com> <20170425040035.GY6263@localhost> <6AADFAC011213A4C87B956458587ADB47BD834@SZXEMI508-MBX.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6AADFAC011213A4C87B956458587ADB47BD834@SZXEMI508-MBX.china.huawei.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: 2234 Lines: 104 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