From: Jan Beulich Date: Mon, 24 Oct 2016 15:03:49 +0000 (-0600) Subject: xenbus: prefer list_for_each() X-Git-Tag: v4.1.12-102.0.20170601_1400~213^2~24^2~34 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=02133e7468bd707afa6426824d220dbb74230f12;p=users%2Fjedix%2Flinux-maple.git xenbus: prefer list_for_each() This is more efficient than list_for_each_safe() when list modification is accompanied by breaking out of the loop. Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross Signed-off-by: David Vrabel OraBug: 25497392 (cherry picked from commit e1e5b3ff41983f506c3cbcf123fe7d682f61a8f1) Signed-off-by: Boris Ostrovsky --- diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index ee10d8e6261f0..ca0b51457c8b6 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -366,7 +366,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); @@ -401,7 +401,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u) } 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);