diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx4/mr.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/mr.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 8e4d26d56a95..8f3666b20ea4 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
@@ -231,7 +231,11 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device | |||
231 | if (!mfrpl) | 231 | if (!mfrpl) |
232 | return ERR_PTR(-ENOMEM); | 232 | return ERR_PTR(-ENOMEM); |
233 | 233 | ||
234 | mfrpl->ibfrpl.page_list = dma_alloc_coherent(&dev->dev->pdev->dev, | 234 | mfrpl->ibfrpl.page_list = kmalloc(size, GFP_KERNEL); |
235 | if (!mfrpl->ibfrpl.page_list) | ||
236 | goto err_free; | ||
237 | |||
238 | mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev, | ||
235 | size, &mfrpl->map, | 239 | size, &mfrpl->map, |
236 | GFP_KERNEL); | 240 | GFP_KERNEL); |
237 | if (!mfrpl->ibfrpl.page_list) | 241 | if (!mfrpl->ibfrpl.page_list) |
@@ -242,6 +246,7 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device | |||
242 | return &mfrpl->ibfrpl; | 246 | return &mfrpl->ibfrpl; |
243 | 247 | ||
244 | err_free: | 248 | err_free: |
249 | kfree(mfrpl->ibfrpl.page_list); | ||
245 | kfree(mfrpl); | 250 | kfree(mfrpl); |
246 | return ERR_PTR(-ENOMEM); | 251 | return ERR_PTR(-ENOMEM); |
247 | } | 252 | } |
@@ -252,8 +257,9 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list) | |||
252 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); | 257 | struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); |
253 | int size = page_list->max_page_list_len * sizeof (u64); | 258 | int size = page_list->max_page_list_len * sizeof (u64); |
254 | 259 | ||
255 | dma_free_coherent(&dev->dev->pdev->dev, size, page_list->page_list, | 260 | dma_free_coherent(&dev->dev->pdev->dev, size, mfrpl->mapped_page_list, |
256 | mfrpl->map); | 261 | mfrpl->map); |
262 | kfree(mfrpl->ibfrpl.page_list); | ||
257 | kfree(mfrpl); | 263 | kfree(mfrpl); |
258 | } | 264 | } |
259 | 265 | ||