Skip to content

Commit

Permalink
vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
Browse files Browse the repository at this point in the history
Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns
error.

Fixes: 94abbcc ("vdpa/mlx5: Add shared memory registration code")
Signed-off-by: Eli Cohen <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Michael S. Tsirkin <[email protected]>
Acked-by: Jason Wang <[email protected]>
Reviewed-by: Stefano Garzarella <[email protected]>
  • Loading branch information
elic307i authored and mstsirkin committed Apr 22, 2021
1 parent a9d0645 commit be286f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/vdpa/mlx5/core/mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
mr->log_size = log_entity_size;
mr->nsg = nsg;
mr->nent = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
if (!mr->nent)
if (!mr->nent) {
err = -ENOMEM;
goto err_map;
}

err = create_direct_mr(mvdev, mr);
if (err)
Expand Down

0 comments on commit be286f8

Please sign in to comment.