]> err.no Git - linux-2.6/commitdiff
mlx4_core: Remove kfree() in mlx4_mr_alloc() error flow
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Thu, 26 Jul 2007 08:16:58 +0000 (11:16 +0300)
committerRoland Dreier <rolandd@cisco.com>
Sat, 28 Jul 2007 15:30:45 +0000 (08:30 -0700)
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>
drivers/net/mlx4/mr.c

index d0808fa3ec822c0d3b231202c535f673f891b597..5b87183e62ce47c292f2b95234d5d4896369503d 100644 (file)
@@ -255,10 +255,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
        int err;
 
        index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap);
-       if (index == -1) {
-               err = -ENOMEM;
-               goto err;
-       }
+       if (index == -1)
+               return -ENOMEM;
 
        mr->iova       = iova;
        mr->size       = size;
@@ -269,15 +267,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
 
        err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt);
        if (err)
-               goto err_index;
-
-       return 0;
-
-err_index:
-       mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index);
+               mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index);
 
-err:
-       kfree(mr);
        return err;
 }
 EXPORT_SYMBOL_GPL(mlx4_mr_alloc);