mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] vdpa/mlx5: Fix error return in map_direct_mr()
@ 2020-10-26  7:06 Jing Xiangfeng
  2020-10-26  7:13 ` Eli Cohen
  2020-10-27  2:44 ` Jason Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Jing Xiangfeng @ 2020-10-26  7:06 UTC (permalink / raw)
  To: mst, jasowang, eli, parav, alex.dewar
  Cc: virtualization, linux-kernel, jingxiangfeng

Fix to return the variable "err" from the error handling case instead
of "ret".

Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
 drivers/vdpa/mlx5/core/mr.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
index ef1c550f8266..4b6195666c58 100644
--- a/drivers/vdpa/mlx5/core/mr.c
+++ b/drivers/vdpa/mlx5/core/mr.c
@@ -239,7 +239,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
 	u64 paend;
 	struct scatterlist *sg;
 	struct device *dma = mvdev->mdev->device;
-	int ret;
 
 	for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
 	     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
 done:
 	mr->log_size = log_entity_size;
 	mr->nsg = nsg;
-	ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
-	if (!ret)
+	err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
+	if (!err)
 		goto err_map;
 
 	err = create_direct_mr(mvdev, mr);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: Fix error return in map_direct_mr()
  2020-10-26  7:06 [PATCH] vdpa/mlx5: Fix error return in map_direct_mr() Jing Xiangfeng
@ 2020-10-26  7:13 ` Eli Cohen
  2020-10-27  2:44 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Cohen @ 2020-10-26  7:13 UTC (permalink / raw)
  To: Jing Xiangfeng
  Cc: mst, jasowang, eli, parav, alex.dewar, virtualization, linux-kernel

On Mon, Oct 26, 2020 at 03:06:37PM +0800, Jing Xiangfeng wrote:
> Fix to return the variable "err" from the error handling case instead
> of "ret".
> 
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>

Acked-by: Eli Cohen <elic@nvidia.com>

> ---
>  drivers/vdpa/mlx5/core/mr.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index ef1c550f8266..4b6195666c58 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -239,7 +239,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
>  	u64 paend;
>  	struct scatterlist *sg;
>  	struct device *dma = mvdev->mdev->device;
> -	int ret;
>  
>  	for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
>  	     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
>  done:
>  	mr->log_size = log_entity_size;
>  	mr->nsg = nsg;
> -	ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
> -	if (!ret)
> +	err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
> +	if (!err)
>  		goto err_map;
>  
>  	err = create_direct_mr(mvdev, mr);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vdpa/mlx5: Fix error return in map_direct_mr()
  2020-10-26  7:06 [PATCH] vdpa/mlx5: Fix error return in map_direct_mr() Jing Xiangfeng
  2020-10-26  7:13 ` Eli Cohen
@ 2020-10-27  2:44 ` Jason Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-10-27  2:44 UTC (permalink / raw)
  To: Jing Xiangfeng, mst, eli, parav, alex.dewar; +Cc: virtualization, linux-kernel


On 2020/10/26 下午3:06, Jing Xiangfeng wrote:
> Fix to return the variable "err" from the error handling case instead
> of "ret".
>
> Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> ---
>   drivers/vdpa/mlx5/core/mr.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index ef1c550f8266..4b6195666c58 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -239,7 +239,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
>   	u64 paend;
>   	struct scatterlist *sg;
>   	struct device *dma = mvdev->mdev->device;
> -	int ret;
>   
>   	for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
>   	     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
>   done:
>   	mr->log_size = log_entity_size;
>   	mr->nsg = nsg;
> -	ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
> -	if (!ret)
> +	err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
> +	if (!err)
>   		goto err_map;
>   
>   	err = create_direct_mr(mvdev, mr);


Acked-by: Jason Wang <jasowang@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-27  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26  7:06 [PATCH] vdpa/mlx5: Fix error return in map_direct_mr() Jing Xiangfeng
2020-10-26  7:13 ` Eli Cohen
2020-10-27  2:44 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®