Skip to content

Commit 9a88787

Browse files
howlettakpm00
authored andcommitted
maple_tree: mas_anode_descend() clang-analyzer cleanup
clang-analyzer reported some Dead Stores in mas_anode_descend(). Upon inspection, there were a few clean ups that would make the code cleaner: The count variable was set from the mt_slots array and then updated but never used again. Just use the array reference directly. Also stop updating the type since it isn't used after the update. Stop setting the gaps pointer to NULL at the start since it is always set before the loop begins. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Liam R. Howlett <[email protected]> Suggested-by: Lukas Bulwahn <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent c61b3a2 commit 9a88787

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/maple_tree.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4968,8 +4968,9 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
49684968
{
49694969
enum maple_type type = mte_node_type(mas->node);
49704970
unsigned long pivot, min, gap = 0;
4971-
unsigned char count, offset;
4972-
unsigned long *gaps = NULL, *pivots = ma_pivots(mas_mn(mas), type);
4971+
unsigned char offset;
4972+
unsigned long *gaps;
4973+
unsigned long *pivots = ma_pivots(mas_mn(mas), type);
49734974
void __rcu **slots = ma_slots(mas_mn(mas), type);
49744975
bool found = false;
49754976

@@ -4980,9 +4981,8 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
49804981

49814982
gaps = ma_gaps(mte_to_node(mas->node), type);
49824983
offset = mas->offset;
4983-
count = mt_slots[type];
49844984
min = mas_safe_min(mas, pivots, offset);
4985-
for (; offset < count; offset++) {
4985+
for (; offset < mt_slots[type]; offset++) {
49864986
pivot = mas_safe_pivot(mas, pivots, offset, type);
49874987
if (offset && !pivot)
49884988
break;
@@ -5008,8 +5008,6 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
50085008
mas->min = min;
50095009
mas->max = pivot;
50105010
offset = 0;
5011-
type = mte_node_type(mas->node);
5012-
count = mt_slots[type];
50135011
break;
50145012
}
50155013
}

0 commit comments

Comments
 (0)