Skip to content

Commit e1e5b3f

Browse files
jbeulichDavid Vrabel
authored andcommitted
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 <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: David Vrabel <[email protected]>
1 parent cb5f7e7 commit e1e5b3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/xen/xenbus/xenbus_dev_frontend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static int xenbus_write_transaction(unsigned msg_type,
364364

365365
static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
366366
{
367-
struct watch_adapter *watch, *tmp_watch;
367+
struct watch_adapter *watch;
368368
char *path, *token;
369369
int err, rc;
370370
LIST_HEAD(staging_q);
@@ -399,7 +399,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
399399
}
400400
list_add(&watch->list, &u->watches);
401401
} else {
402-
list_for_each_entry_safe(watch, tmp_watch, &u->watches, list) {
402+
list_for_each_entry(watch, &u->watches, list) {
403403
if (!strcmp(watch->token, token) &&
404404
!strcmp(watch->watch.node, path)) {
405405
unregister_xenbus_watch(&watch->watch);

0 commit comments

Comments
 (0)