diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2007-07-26 04:16:58 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-07-28 11:30:45 -0400 |
commit | 0172e2e14c3c1df10ec0fa31d9f41c1bc3a472f3 (patch) | |
tree | 3c9eb482826b1d3c40a428f4911bdd0202ac786d /drivers | |
parent | 4e8e6ee380c3858151165d7455b4954782f145a0 (diff) |
mlx4_core: Remove kfree() in mlx4_mr_alloc() error flow
mlx4_mr_alloc() doesn't actually allocate mr (it just initializes the
pointer that the caller passes in), so it shouldn't free it if an
error occurs.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/mlx4/mr.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c index d0808fa3ec82..5b87183e62ce 100644 --- a/drivers/net/mlx4/mr.c +++ b/drivers/net/mlx4/mr.c | |||
@@ -255,10 +255,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, | |||
255 | int err; | 255 | int err; |
256 | 256 | ||
257 | index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap); | 257 | index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap); |
258 | if (index == -1) { | 258 | if (index == -1) |
259 | err = -ENOMEM; | 259 | return -ENOMEM; |
260 | goto err; | ||
261 | } | ||
262 | 260 | ||
263 | mr->iova = iova; | 261 | mr->iova = iova; |
264 | mr->size = size; | 262 | mr->size = size; |
@@ -269,15 +267,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, | |||
269 | 267 | ||
270 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); | 268 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); |
271 | if (err) | 269 | if (err) |
272 | goto err_index; | 270 | mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index); |
273 | |||
274 | return 0; | ||
275 | |||
276 | err_index: | ||
277 | mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index); | ||
278 | 271 | ||
279 | err: | ||
280 | kfree(mr); | ||
281 | return err; | 272 | return err; |
282 | } | 273 | } |
283 | EXPORT_SYMBOL_GPL(mlx4_mr_alloc); | 274 | EXPORT_SYMBOL_GPL(mlx4_mr_alloc); |