]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
lib/rbtree.c: fix the example typo
authorChisheng Chen <johnny1001s000602@gmail.com>
Thu, 3 Apr 2025 11:26:14 +0000 (19:26 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:54:04 +0000 (17:54 -0700)
Replace `sr` with `Sr`.  The condition `!tmp1 || rb_is_black(tmp1)`
ensures that `tmp1` (which is `sibling->rb_right`) is either NULL or a
black node.  Therefore, the right child of the sibling must be black, and
the example should use `Sr` instead of `sr`.

Link: https://lkml.kernel.org/r/20250403112614.570140-1-johnny1001s000602@gmail.com
Signed-off-by: Chisheng Chen <johnny1001s000602@gmail.com>
Cc: Hsin Chang Yu <zxcvb600870024@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/rbtree.c

index 989c2d615f927a1e7415f1c8888db4f69f6dd0c9..5114eda6309c9d867a3e1ed9358bf9b3b275eb71 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);