[PATCH][next] RDMA/mlx5: remove redundant check on err on return expression

Colin Ian King posted 1 patch 2 months, 3 weeks ago
drivers/infiniband/hw/mlx5/umr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH][next] RDMA/mlx5: remove redundant check on err on return expression
Posted by Colin Ian King 2 months, 3 weeks ago
Currently all paths that set err and then check it for an error
perform immediate returns, hence err always zero at the end of
the function _mlx5r_umr_zap_mkey.  The return expression
err ? err : nblocks has a redundant check on the err since err
is always zero, so just return nblocks instead.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/infiniband/hw/mlx5/umr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
index b097d8839cad..fa5c4ea685b9 100644
--- a/drivers/infiniband/hw/mlx5/umr.c
+++ b/drivers/infiniband/hw/mlx5/umr.c
@@ -1050,7 +1050,7 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
 		}
 	}
 
-	return err ? err : nblocks;
+	return nblocks;
 }
 
 /**
-- 
2.50.0
Re: [PATCH][next] RDMA/mlx5: remove redundant check on err on return expression
Posted by Leon Romanovsky 2 months, 3 weeks ago
On Thu, 17 Jul 2025 12:21:08 +0100, Colin Ian King wrote:
> Currently all paths that set err and then check it for an error
> perform immediate returns, hence err always zero at the end of
> the function _mlx5r_umr_zap_mkey.  The return expression
> err ? err : nblocks has a redundant check on the err since err
> is always zero, so just return nblocks instead.
> 
> 
> [...]

Applied, thanks!

[1/1] RDMA/mlx5: remove redundant check on err on return expression
      https://git.kernel.org/rdma/rdma/c/aee80e6ffc5878

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>