linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Remove redundant assignment to ret
@ 2021-05-06 10:13 Yang Li
  2021-05-06 11:32 ` Leon Romanovsky
  2021-05-11 19:37 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Li @ 2021-05-06 10:13 UTC (permalink / raw)
  To: leon
  Cc: dledford, jgg, nathan, ndesaulniers, linux-rdma, linux-kernel,
	clang-built-linux, Yang Li

Variable 'ret' is set to the rerurn value of function
mlx5_mr_cache_alloc() but this value is never read as it is
overwritten with a new value later on, hence it is a redundant
assignment and can be removed

Clean up the following clang-analyzer warning:

drivers/infiniband/hw/mlx5/odp.c:421:2: warning: Value stored to 'ret'
is never read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/infiniband/hw/mlx5/odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 782b2af..87fa0b2 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -418,7 +418,7 @@ static struct mlx5_ib_mr *implicit_get_child_mr(struct mlx5_ib_mr *imr,
 	if (IS_ERR(odp))
 		return ERR_CAST(odp);
 
-	ret = mr = mlx5_mr_cache_alloc(
+	mr = mlx5_mr_cache_alloc(
 		mr_to_mdev(imr), MLX5_IMR_MTT_CACHE_ENTRY, imr->access_flags);
 	if (IS_ERR(mr)) {
 		ib_umem_odp_release(odp);
-- 
1.8.3.1


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

* Re: [PATCH] RDMA/mlx5: Remove redundant assignment to ret
  2021-05-06 10:13 [PATCH] RDMA/mlx5: Remove redundant assignment to ret Yang Li
@ 2021-05-06 11:32 ` Leon Romanovsky
  2021-05-11 19:37 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-05-06 11:32 UTC (permalink / raw)
  To: Yang Li
  Cc: dledford, jgg, nathan, ndesaulniers, linux-rdma, linux-kernel,
	clang-built-linux

On Thu, May 06, 2021 at 06:13:21PM +0800, Yang Li wrote:
> Variable 'ret' is set to the rerurn value of function
> mlx5_mr_cache_alloc() but this value is never read as it is
> overwritten with a new value later on, hence it is a redundant
> assignment and can be removed
> 
> Clean up the following clang-analyzer warning:
> 
> drivers/infiniband/hw/mlx5/odp.c:421:2: warning: Value stored to 'ret'
> is never read [clang-analyzer-deadcode.DeadStores]
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/infiniband/hw/mlx5/odp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Fixes: e6fb246ccafb ("RDMA/mlx5: Consolidate MR destruction to mlx5_ib_dereg_mr()")

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH] RDMA/mlx5: Remove redundant assignment to ret
  2021-05-06 10:13 [PATCH] RDMA/mlx5: Remove redundant assignment to ret Yang Li
  2021-05-06 11:32 ` Leon Romanovsky
@ 2021-05-11 19:37 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-05-11 19:37 UTC (permalink / raw)
  To: Yang Li
  Cc: leon, dledford, nathan, ndesaulniers, linux-rdma, linux-kernel,
	clang-built-linux

On Thu, May 06, 2021 at 06:13:21PM +0800, Yang Li wrote:
> Variable 'ret' is set to the rerurn value of function
> mlx5_mr_cache_alloc() but this value is never read as it is
> overwritten with a new value later on, hence it is a redundant
> assignment and can be removed
> 
> Clean up the following clang-analyzer warning:
> 
> drivers/infiniband/hw/mlx5/odp.c:421:2: warning: Value stored to 'ret'
> is never read [clang-analyzer-deadcode.DeadStores]
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/odp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-05-11 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 10:13 [PATCH] RDMA/mlx5: Remove redundant assignment to ret Yang Li
2021-05-06 11:32 ` Leon Romanovsky
2021-05-11 19:37 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).