From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbdJSIRf (ORCPT ); Thu, 19 Oct 2017 04:17:35 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:20528 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdJSIRd (ORCPT ); Thu, 19 Oct 2017 04:17:33 -0400 Date: Thu, 19 Oct 2017 11:17:18 +0300 From: Dan Carpenter To: Srishti Sharma Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, outreachy-kernel@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] Staging: rtl8188eu: core: rtw_ap: Use list_for_each_entry_safe Message-ID: <20171019081718.luqsobcus7ihzipm@mwanda> References: <869f4d40ae746a70e2b7456a143a6f966fbe05c9.1508354332.git.srishtishar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <869f4d40ae746a70e2b7456a143a6f966fbe05c9.1508354332.git.srishtishar@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 19, 2017 at 01:01:14AM +0530, Srishti Sharma wrote: > This is a cleanup patch and doesn't change runtime behaviour. It > changes an open coded list traversal to use list_for_each_entry_safe. > Done using the following semantic patch by coccinelle. > > @r@ > struct list_head* l; > expression e; > identifier m,list_del_init,f; > type T1; > T1* pos; > iterator name list_for_each_entry_safe; > @@ > > f(...){ > > +T1* tmp; > <+... > -while(...) > +list_for_each_entry_safe(pos,tmp,l,m) > { > ... > -pos = container_of(l,T1,m); > ... > -l=e; > <+... > list_del_init(&pos->m) > ...+> > } > ...+> > > } > > Signed-off-by: Srishti Sharma > --- > drivers/staging/rtl8188eu/core/rtw_ap.c | 34 +++++++++------------------------ > 1 file changed, 9 insertions(+), 25 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c > index 32a4837..551af9e 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_ap.c > +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c > @@ -280,7 +280,7 @@ void expire_timeout_chk(struct adapter *padapter) > { > struct list_head *phead, *plist; > u8 updated = 0; > - struct sta_info *psta = NULL; > + struct sta_info *psta = NULL, *tmp; > struct sta_priv *pstapriv = &padapter->stapriv; > u8 chk_alive_num = 0; > char chk_alive_list[NUM_STA]; > @@ -292,10 +292,7 @@ void expire_timeout_chk(struct adapter *padapter) > plist = phead->next; > > /* check auth_queue */ > - while (phead != plist) { > - psta = container_of(plist, struct sta_info, auth_list); > - plist = plist->next; > - > + list_for_each_entry_safe(psta, tmp, plist, auth_list) { This one as well. (I'm reviewing in reverse order) We don't need plist, just phead. regards, dan carpenter