Commit 674dd365 authored by SeongJae Park's avatar SeongJae Park Committed by Paul E. McKenney

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: default avatarSeongJae Park <sj@kernel.org>
Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 3f831e38
......@@ -56,7 +56,7 @@ but a version with an additional memory barrier (smp_rmb())
struct hlist_node *node, *next;
for (pos = rcu_dereference((head)->first);
pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) &&
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
pos = rcu_dereference(next))
if (obj->key == key)
return obj;
......@@ -68,7 +68,7 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb()::
struct hlist_node *node;
for (pos = rcu_dereference((head)->first);
pos && ({ prefetch(pos->next); 1; }) &&
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });
({ obj = hlist_entry(pos, typeof(*obj), member); 1; });
pos = rcu_dereference(pos->next))
if (obj->key == key)
return obj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment