Skip to contentSkip to conversation

lib: maple_tree: fix boolreturn.cocci warning

PATCH In review Wan Jiabing 2 participants 2 messages Feb 25, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: maple_tree: fix boolreturn.cocci warning

Fix following coccicheck warning:
./lib/maple_tree.c:4177:9-10: WARNING: return of 0/1 in function mas_wr_append with return type bool.

---
 lib/maple_tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/maple_tree.c +3 -3
index 5f7295ba0309..933483726b85 100644
@@ -4174,7 +4174,7 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas)
 		mas->offset = new_end;
 		wr_mas->pivots[end] = mas->index - 1;
 
-		return 1;
+		return true;
 	} else if ((mas->index == wr_mas->r_min) && (mas->last < wr_mas->r_max)) {
 		if (new_end < node_pivots)
 			wr_mas->pivots[new_end] = wr_mas->pivots[end];
@@ -4185,9 +4185,9 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas)
 
 		wr_mas->pivots[end] = mas->last;
 		rcu_assign_pointer(wr_mas->slots[end], wr_mas->entry);
-		return 1;
+		return true;
 	}
-	return 0;
+	return false;
 }
 
 static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
Signature · 1 line
2.35.1
#1 lore raw

Thanks for the report, I will make this change in linux-next

Liam

Quoted 37 lines · Wan Jiabing

Fix following coccicheck warning:
./lib/maple_tree.c:4177:9-10: WARNING: return of 0/1 in function mas_wr_append with return type bool.

---
 lib/maple_tree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/maple_tree.c +3 -3
index 5f7295ba0309..933483726b85 100644
@@ -4174,7 +4174,7 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas)
 		mas->offset = new_end;
 		wr_mas->pivots[end] = mas->index - 1;
 
-		return 1;
+		return true;
 	} else if ((mas->index == wr_mas->r_min) && (mas->last < wr_mas->r_max)) {
 		if (new_end < node_pivots)
 			wr_mas->pivots[new_end] = wr_mas->pivots[end];
@@ -4185,9 +4185,9 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas)
 
 		wr_mas->pivots[end] = mas->last;
 		rcu_assign_pointer(wr_mas->slots[end], wr_mas->entry);
-		return 1;
+		return true;
 	}
-	return 0;
+	return false;
 }
 
 static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
Signature · 1 line
2.35.1