From: Roland Dreier Date: Tue, 29 May 2007 23:07:09 +0000 (-0700) Subject: IB/mlx4: Fix last allocated object tracking in bitmap allocator X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2cb4a98f243d01f2c8d5799c764bb96ffa66c44;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 --- 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) if (obj < bitmap->max) { set_bit(obj, bitmap->table); + bitmap->last = (obj + 1) & (bitmap->max - 1); obj |= bitmap->top; - bitmap->last = obj + 1; } else obj = -1;