Skip to content

Commit 7ba08e8

Browse files
hiss2018mstsirkin
authored andcommitted
vdpa/mlx5: Fix error return in map_direct_mr()
Fix to return the variable "err" from the error handling case instead of "ret". Fixes: 94abbcc ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com> Link: https://lore.kernel.org/r/20201026070637.164321-1-jingxiangfeng@huawei.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Eli Cohen <elic@nvidia.com> Cc: stable@vger.kernel.org Acked-by: Jason Wang <jasowang@redhat.com>
1 parent 7922460 commit 7ba08e8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • drivers/vdpa/mlx5/core

drivers/vdpa/mlx5/core/mr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
239239
u64 paend;
240240
struct scatterlist *sg;
241241
struct device *dma = mvdev->mdev->device;
242-
int ret;
243242

244243
for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
245244
map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
@@ -277,8 +276,8 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
277276
done:
278277
mr->log_size = log_entity_size;
279278
mr->nsg = nsg;
280-
ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
281-
if (!ret)
279+
err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
280+
if (!err)
282281
goto err_map;
283282

284283
err = create_direct_mr(mvdev, mr);

0 commit comments

Comments
 (0)