Skip to content

Commit 674dd36

Browse files
sjp38paulmckrcu
authored andcommitted
Docs/RCU/rculist_nulls: Assign 'obj' before use from the examples
Lookup example code snippets in rculist_nulls.rst are using 'obj' without assignment. Fix the code to assign it properly. Signed-off-by: SeongJae Park <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 3f831e3 commit 674dd36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Documentation/RCU/rculist_nulls.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ but a version with an additional memory barrier (smp_rmb())
5656
struct hlist_node *node, *next;
5757
for (pos = rcu_dereference((head)->first);
5858
pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) &&
59-
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });
59+
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
6060
pos = rcu_dereference(next))
6161
if (obj->key == key)
6262
return obj;
@@ -68,7 +68,7 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb()::
6868
struct hlist_node *node;
6969
for (pos = rcu_dereference((head)->first);
7070
pos && ({ prefetch(pos->next); 1; }) &&
71-
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });
71+
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
7272
pos = rcu_dereference(pos->next))
7373
if (obj->key == key)
7474
return obj;

0 commit comments

Comments
 (0)