net/mlx4: Fix error check for dma_map_sg

dma_map_sg return 0 on error.

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20220825063533.21015-1-jinpu.wang@ionos.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jack Wang 2022-08-25 08:35:33 +02:00 committed by Jakub Kicinski
parent 6005a8aece
commit 0c1f77d87d
1 changed files with 2 additions and 2 deletions

View File

@ -208,7 +208,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
chunk->sg, chunk->npages,
DMA_BIDIRECTIONAL);
if (chunk->nsg <= 0)
if (!chunk->nsg)
goto fail;
}
@ -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->npages, DMA_BIDIRECTIONAL);
if (chunk->nsg <= 0)
if (!chunk->nsg)
goto fail;
}