Skip to contentSkip to conversation

rbtree: Remove unneeded check condition in rb_find_first

PATCH In review Li RongQing 2 participants 3 messages Sep 30, 2021 – Oct 22, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rbtree: Remove unneeded check condition in rb_find_first

the variable c is int type, so change the following condition

	 if (c <= 0) {

	 }
	 else if (c > 0) {

	 }
as:
	 if (c <= 0) {

	 }
	 else {

	 }
---
 include/linux/rbtree.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/rbtree.h +1 -1
index 235047d..d5ac8f7 100644
@@ -294,7 +294,7 @@ static inline void rb_replace_node_cached(struct rb_node *victim,
 			if (!c)
 				match = node;
 			node = node->rb_left;
-		} else if (c > 0) {
+		} else {
 			node = node->rb_right;
 		}
 	}
Signature · 1 line
1.7.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Li RongQing

the variable c is int type, so change the following condition

	 if (c <= 0) {

	 }
	 else if (c > 0) {

	 }
as:
	 if (c <= 0) {

	 }
	 else {

	 }
---
 include/linux/rbtree.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/rbtree.h +0 -0
index 235047d..d5ac8f7 100644

include/linux/rbtree.h static inline void rb_replace_node_cached(struct rb_node *victim, · line 300

Quoted 8 lines
include/linux/rbtree.h +1 -1
@@ -294,7 +294,7 @@ static inline void rb_replace_node_cached(struct rb_node *victim,
 			if (!c)
 				match = node;
 			node = node->rb_left;
-		} else if (c > 0) {
+		} else {
 			node = node->rb_right;
 		}
 	}

Looks good to me, thanks for the fix.

--
Michel "walken" Lespinasse

#2 lore raw

Ping

-Li

Quoted 44 lines · Li RongQing

include/linux/rbtree.h static inline void rb_replace_node_cached(struct

Quoted 27 lines

the variable c is int type, so change the following condition

	 if (c <= 0) {

	 }
	 else if (c > 0) {

	 }
as:
	 if (c <= 0) {

	 }
	 else {

	 }
---
 include/linux/rbtree.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/rbtree.h index renamed from include/linux/rbtree.h +0 -0

235047d..d5ac8f7 100644

include/linux/rbtree.h +0 -0
@@ -294,7 +294,7 @@ static inline void rb_replace_node_cached(struct

rb_node *victim,

include/linux/rbtree.h static inline void rb_replace_node_cached(struct rb_node *victim, · line 300

Quoted 8 lines
include/linux/rbtree.h +1 -1
 			if (!c)
 				match = node;
 			node = node->rb_left;
-		} else if (c > 0) {
+		} else {
 			node = node->rb_right;
 		}
 	}

Looks good to me, thanks for the fix.

--
Michel "walken" Lespinasse