mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] RDMA/mlx5: remove redundant check on err on return expression
@ 2025-07-17 11:21 Colin Ian King
  2025-07-17 12:20 ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-07-17 11:21 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe, linux-rdma
  Cc: kernel-janitors, linux-kernel

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


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

* Re: [PATCH][next] RDMA/mlx5: remove redundant check on err on return expression
  2025-07-17 11:21 [PATCH][next] RDMA/mlx5: remove redundant check on err on return expression Colin Ian King
@ 2025-07-17 12:20 ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2025-07-17 12:20 UTC (permalink / raw)
  To: Jason Gunthorpe, linux-rdma, Colin Ian King; +Cc: kernel-janitors, linux-kernel


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>


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

end of thread, other threads:[~2025-07-17 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-17 11:21 [PATCH][next] RDMA/mlx5: remove redundant check on err on return expression Colin Ian King
2025-07-17 12:20 ` Leon Romanovsky

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®