Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2cb4a98 authored by Roland Dreier's avatar Roland Dreier
Browse files

IB/mlx4: Fix last allocated object tracking in bitmap allocator



Set last allocated object to the object after the one just allocated
before ORing in the extra top bits.  Also handle the case where this
wraps around.

Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent d998ccce
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -51,8 +51,8 @@ u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap)


	if (obj < bitmap->max) {
	if (obj < bitmap->max) {
		set_bit(obj, bitmap->table);
		set_bit(obj, bitmap->table);
		bitmap->last = (obj + 1) & (bitmap->max - 1);
		obj |= bitmap->top;
		obj |= bitmap->top;
		bitmap->last = obj + 1;
	} else
	} else
		obj = -1;
		obj = -1;