Commit 0c1f77d8 authored by Jack Wang's avatar Jack Wang Committed by Jakub Kicinski

net/mlx4: Fix error check for dma_map_sg

dma_map_sg return 0 on error.
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20220825063533.21015-1-jinpu.wang@ionos.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6005a8ae
...@@ -208,7 +208,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, ...@@ -208,7 +208,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
chunk->sg, chunk->npages, chunk->sg, chunk->npages,
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if (chunk->nsg <= 0) if (!chunk->nsg)
goto fail; goto fail;
} }
...@@ -222,7 +222,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, ...@@ -222,7 +222,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg, chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg,
chunk->npages, DMA_BIDIRECTIONAL); chunk->npages, DMA_BIDIRECTIONAL);
if (chunk->nsg <= 0) if (!chunk->nsg)
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment