Skip to content

Commit

Permalink
maple_tree: mas_anode_descend() clang-analyzer cleanup
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
howlett authored and akpm00 committed Nov 8, 2022
1 parent c61b3a2 commit 9a88787
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/maple_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4968,8 +4968,9 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
{
enum maple_type type = mte_node_type(mas->node);
unsigned long pivot, min, gap = 0;
unsigned char count, offset;
unsigned long *gaps = NULL, *pivots = ma_pivots(mas_mn(mas), type);
unsigned char offset;
unsigned long *gaps;
unsigned long *pivots = ma_pivots(mas_mn(mas), type);
void __rcu **slots = ma_slots(mas_mn(mas), type);
bool found = false;

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

gaps = ma_gaps(mte_to_node(mas->node), type);
offset = mas->offset;
count = mt_slots[type];
min = mas_safe_min(mas, pivots, offset);
for (; offset < count; offset++) {
for (; offset < mt_slots[type]; offset++) {
pivot = mas_safe_pivot(mas, pivots, offset, type);
if (offset && !pivot)
break;
Expand All @@ -5008,8 +5008,6 @@ static inline bool mas_anode_descend(struct ma_state *mas, unsigned long size)
mas->min = min;
mas->max = pivot;
offset = 0;
type = mte_node_type(mas->node);
count = mt_slots[type];
break;
}
}
Expand Down

0 comments on commit 9a88787

Please sign in to comment.