diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index e1743803c8512519baf7c6511959284a7062837f..fbde494444b8918cc34fc7f38a79da5d84ad84d8 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2903,8 +2903,8 @@ static inline void *mtree_range_walk(struct ma_state *mas)
 	unsigned long max, min;
 	unsigned long prev_max, prev_min;
 
-	last = next = mas->node;
-	prev_min = min = mas->min;
+	next = mas->node;
+	min = mas->min;
 	max = mas->max;
 	do {
 		offset = 0;