From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbcGGMhu (ORCPT ); Thu, 7 Jul 2016 08:37:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:58399 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750859AbcGGMhm (ORCPT ); Thu, 7 Jul 2016 08:37:42 -0400 Subject: Re: [PATCH] xenbus: prefer list_for_each() To: Jan Beulich , David Vrabel , Boris Ostrovsky References: <577E21EE02000078000FBDBD@suse.com> Cc: xen-devel , lkml From: Juergen Gross Message-ID: <577E4D13.10105@suse.com> Date: Thu, 7 Jul 2016 14:37:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <577E21EE02000078000FBDBD@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/07/16 09:33, Jan Beulich wrote: > ... over list_for_each_safe() when list modification if accompanied by > breaking out of the loop. > > Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross > --- > drivers/xen/xenbus/xenbus_dev_frontend.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > --- 4.7-rc6-xen.orig/drivers/xen/xenbus/xenbus_dev_frontend.c > +++ 4.7-rc6-xen/drivers/xen/xenbus/xenbus_dev_frontend.c > @@ -364,7 +364,7 @@ out: > > static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) > { > - struct watch_adapter *watch, *tmp_watch; > + struct watch_adapter *watch; > char *path, *token; > int err, rc; > LIST_HEAD(staging_q); > @@ -399,7 +399,7 @@ static int xenbus_write_watch(unsigned m > } > list_add(&watch->list, &u->watches); > } else { > - list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) { > + list_for_each_entry(watch, &u->watches, list) { > if (!strcmp(watch->token, token) && > !strcmp(watch->watch.node, path)) { > unregister_xenbus_watch(&watch->watch); > >