aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4/alloc.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2007-05-29 19:07:09 -0400
committerRoland Dreier <rolandd@cisco.com>2007-05-29 19:07:09 -0400
commita2cb4a98f243d01f2c8d5799c764bb96ffa66c44 (patch)
tree8bf4e73ab877936da113969c941a51e6aef8d319 /drivers/net/mlx4/alloc.c
parentd998ccce020e2cfcf11c6b57503532930ede2894 (diff)
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: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/net/mlx4/alloc.c')
-rw-r--r--drivers/net/mlx4/alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index dfbd5809d744..f8d63d39f592 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -51,8 +51,8 @@ u32 mlx4_bitmap_alloc(struct mlx4_bitmap *bitmap)
51 51
52 if (obj < bitmap->max) { 52 if (obj < bitmap->max) {
53 set_bit(obj, bitmap->table); 53 set_bit(obj, bitmap->table);
54 bitmap->last = (obj + 1) & (bitmap->max - 1);
54 obj |= bitmap->top; 55 obj |= bitmap->top;
55 bitmap->last = obj + 1;
56 } else 56 } else
57 obj = -1; 57 obj = -1;
58 58