Skip to contentSkip to conversation

xenbus: prefer list_for_each()

PATCH Juergen Gross 1 participant 2 messages Jul 7, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Juergen Gross

author Reviewed-by
#1 lore raw
Quoted 4 lines · Jan Beulich

... over list_for_each_safe() when list modification if accompanied by breaking out of the loop.

Quoted 18 lines
---
 drivers/xen/xenbus/xenbus_dev_frontend.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +1 -1
@@ -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);

drivers/xen/xenbus/xenbus_dev_frontend.c static int xenbus_write_watch(unsigned m · line 405

Quoted 8 lines
drivers/xen/xenbus/xenbus_dev_frontend.c +1 -1
@@ -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);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author Reviewed-by
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Jan Beulich

... over list_for_each_safe() when list modification if accompanied by breaking out of the loop.

Quoted 26 lines
---
 drivers/xen/xenbus/xenbus_dev_frontend.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +2 -2
@@ -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);