Skip to contentSkip to conversation

ocfs2-remove-usage-of-list-iterator-variable-after-the-loop-body.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 10, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: ocfs2: remove usage of list iterator variable after the loop body
has been removed from the -mm tree. Its filename was
ocfs2-remove-usage-of-list-iterator-variable-after-the-loop-body.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jakob Koschel <[email protected]>
Subject: ocfs2: remove usage of list iterator variable after the loop body

To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body.

To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable [1].

---

 fs/ocfs2/dlm/dlmdebug.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
fs/ocfs2/dlm/dlmdebug.c renamed from fs/ocfs2/dlm/dlmdebug.c~ocfs2-remove-usage-of-list-iterator-variable-after-the-loop-body +6 -6
@@ -541,7 +541,7 @@ static void *lockres_seq_start(struct se
 	struct debug_lockres *dl = m->private;
 	struct dlm_ctxt *dlm = dl->dl_ctxt;
 	struct dlm_lock_resource *oldres = dl->dl_res;
-	struct dlm_lock_resource *res = NULL;
+	struct dlm_lock_resource *res = NULL, *iter;
 	struct list_head *track_list;
 
 	spin_lock(&dlm->track_lock);
@@ -556,11 +556,11 @@ static void *lockres_seq_start(struct se
 		}
 	}
 
-	list_for_each_entry(res, track_list, tracking) {
-		if (&res->tracking == &dlm->tracking_list)
-			res = NULL;
-		else
-			dlm_lockres_get(res);
+	list_for_each_entry(iter, track_list, tracking) {
+		if (&iter->tracking != &dlm->tracking_list) {
+			dlm_lockres_get(iter);
+			res = iter;
+		}
 		break;
 	}
 	spin_unlock(&dlm->track_lock);

_

Patches currently in -mm which might be from [email protected] are