]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/rbtree.c: fix the example typo
authorHsin Chang Yu <zxcvb600870024@gmail.com>
Fri, 28 Jun 2024 14:22:29 +0000 (22:22 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 5 Jul 2024 06:43:10 +0000 (23:43 -0700)
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.com
Signed-off-by: Hsin Chang Yu <zxcvb600870024@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/rbtree.c

index 5114eda6309c9d867a3e1ed9358bf9b3b275eb71..989c2d615f927a1e7415f1c8888db4f69f6dd0c9 100644 (file)
@@ -297,9 +297,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root,
                                 *   / \           / \
                                 *  N   S    -->  N   sl
                                 *     / \             \
-                                *    sl  Sr            S
+                                *    sl  sr            S
                                 *                       \
-                                *                        Sr
+                                *                        sr
                                 *
                                 * Note: p might be red, and then both
                                 * p and sl are red after rotation(which
@@ -312,9 +312,9 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root,
                                 *   / \            /  \
                                 *  N   sl   -->   P    S
                                 *       \        /      \
-                                *        S      N        Sr
+                                *        S      N        sr
                                 *         \
-                                *          Sr
+                                *          sr
                                 */
                                tmp1 = tmp2->rb_right;
                                WRITE_ONCE(sibling->rb_left, tmp1);