IB/mlx5: Fix list_del of empty list

For archs with pages size of 4K, when the chunk is freed, fwp is not in the
list so avoid attempting to delete it.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
Eli Cohen 2013-10-31 15:26:33 +02:00 committed by Roland Dreier
parent 7e2e19210a
commit 2b136d0253
1 changed files with 2 additions and 1 deletions

View File

@ -229,6 +229,7 @@ static void free_4k(struct mlx5_core_dev *dev, u64 addr)
set_bit(n, &fwp->bitmask); set_bit(n, &fwp->bitmask);
if (fwp->free_count == MLX5_NUM_4K_IN_PAGE) { if (fwp->free_count == MLX5_NUM_4K_IN_PAGE) {
rb_erase(&fwp->rb_node, &dev->priv.page_root); rb_erase(&fwp->rb_node, &dev->priv.page_root);
if (fwp->free_count != 1)
list_del(&fwp->list); list_del(&fwp->list);
dma_unmap_page(&dev->pdev->dev, addr, PAGE_SIZE, DMA_BIDIRECTIONAL); dma_unmap_page(&dev->pdev->dev, addr, PAGE_SIZE, DMA_BIDIRECTIONAL);
__free_page(fwp->page); __free_page(fwp->page);