Commit cedb08ca authored by Hsin Chang Yu's avatar Hsin Chang Yu Committed by Andrew Morton

lib/rbtree.c: fix the example typo

Replace the "Sr" with "sr", the example is wrong if sl and N don't have
child nodes, so sr should be red node.

Link: https://lkml.kernel.org/r/20240628142229.69419-1-zxcvb600870024@gmail.comSigned-off-by: default avatarHsin Chang Yu <zxcvb600870024@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 255547c6
...@@ -297,9 +297,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root, ...@@ -297,9 +297,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root,
* / \ / \ * / \ / \
* N S --> N sl * N S --> N sl
* / \ \ * / \ \
* sl Sr S * sl sr S
* \ * \
* Sr * sr
* *
* Note: p might be red, and then both * Note: p might be red, and then both
* p and sl are red after rotation(which * p and sl are red after rotation(which
...@@ -312,9 +312,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root, ...@@ -312,9 +312,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root,
* / \ / \ * / \ / \
* N sl --> P S * N sl --> P S
* \ / \ * \ / \
* S N Sr * S N sr
* \ * \
* Sr * sr
*/ */
tmp1 = tmp2->rb_right; tmp1 = tmp2->rb_right;
WRITE_ONCE(sibling->rb_left, tmp1); WRITE_ONCE(sibling->rb_left, tmp1);
......
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