diff options
author | Eli Cohen <elic@nvidia.com> | 2021-04-11 11:36:46 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-04-22 18:15:31 -0400 |
commit | be286f84e33da1a7f83142b64dbd86f600e73363 (patch) | |
tree | 793255f786e93b1842148ae2ec61de58a0a018d7 | |
parent | a9d064524fc3cf463b3bb14fa63de78aafb40dab (diff) |
vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails
Set err = -ENOMEM if dma_map_sg_attrs() fails so the function reutrns
error.
Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210411083646.910546-1-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
-rw-r--r-- | drivers/vdpa/mlx5/core/mr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c index 3908ff28eec0..800cfd1967ad 100644 --- a/drivers/vdpa/mlx5/core/mr.c +++ b/drivers/vdpa/mlx5/core/mr.c @@ -278,8 +278,10 @@ done: 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) |