Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321778
b: refs/heads/master
c: 89dd86d
h: refs/heads/master
v: v3
  • Loading branch information
Yishai Hadas authored and Roland Dreier committed Aug 16, 2012
1 parent daf3955 commit 0f0006e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: df7fba66471c6bbbaebb55e1bb3658eb7ce00a9b
refs/heads/master: 89dd86db78e08b51bab29e168fd41b2fd943e6b6
18 changes: 14 additions & 4 deletions trunk/drivers/net/ethernet/mellanox/mlx4/mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/vmalloc.h>

#include <linux/mlx4/cmd.h>

Expand Down Expand Up @@ -130,8 +131,11 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order)
for (i = 0; i <= buddy->max_order; ++i) {
s = BITS_TO_LONGS(1 << (buddy->max_order - i));
buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL);
if (!buddy->bits[i])
goto err_out_free;
if (!buddy->bits[i]) {
buddy->bits[i] = vmalloc(s * sizeof(long));
if (!buddy->bits[i])
goto err_out_free;
}
bitmap_zero(buddy->bits[i], 1 << (buddy->max_order - i));
}

Expand All @@ -142,7 +146,10 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order)

err_out_free:
for (i = 0; i <= buddy->max_order; ++i)
kfree(buddy->bits[i]);
if (buddy->bits[i] && is_vmalloc_addr(buddy->bits[i]))
vfree(buddy->bits[i]);
else
kfree(buddy->bits[i]);

err_out:
kfree(buddy->bits);
Expand All @@ -156,7 +163,10 @@ static void mlx4_buddy_cleanup(struct mlx4_buddy *buddy)
int i;

for (i = 0; i <= buddy->max_order; ++i)
kfree(buddy->bits[i]);
if (is_vmalloc_addr(buddy->bits[i]))
vfree(buddy->bits[i]);
else
kfree(buddy->bits[i]);

kfree(buddy->bits);
kfree(buddy->num_free);
Expand Down

0 comments on commit 0f0006e

Please sign in to comment.