Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965262AbdD1IHe convert rfc822-to-8bit (ORCPT ); Fri, 28 Apr 2017 04:07:34 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:5812 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756145AbdD1IHV (ORCPT ); Fri, 28 Apr 2017 04:07:21 -0400 From: "weiyongjun (A)" To: Vinod Koul 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 Thread-Topic: [PATCH -next] ASoC: Intel: Skylake: Fix to use list_for_each_safe() when delete items Thread-Index: AQHSvXQDEp7MJg8QVkaPwiit8BRlSqHU7/eAgADIBFCAAOWMgIAD09Kw Date: Fri, 28 Apr 2017 08:06:50 +0000 Message-ID: <6AADFAC011213A4C87B956458587ADB47CD825@SZXEMI508-MBX.china.huawei.com> References: <20170425032817.21959-1-weiyj.lk@gmail.com> <20170425040035.GY6263@localhost> <6AADFAC011213A4C87B956458587ADB47BD834@SZXEMI508-MBX.china.huawei.com> <20170426053803.GE6263@localhost> In-Reply-To: <20170426053803.GE6263@localhost> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.30.138] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5902F821.0026,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.9.187, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0a89ffbeba25ee504f983f453ab72692 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2613 Lines: 111 > 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 :) Oh, a similar patch has been applied. Please ignore this one. https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=550b349af0f0e33fedb252aca8dc144299aca308 > > > > > @@ > > 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