Skip to contentSkip to conversation

RDMA/mlx5: remove redundant check on err on return expression

PATCH Applied Colin Ian King 2 participants 2 messages Jul 17, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx5: remove redundant check on err on return expression

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.

---
 drivers/infiniband/hw/mlx5/umr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/umr.c +1 -1
index b097d8839cad..fa5c4ea685b9 100644
@@ -1050,7 +1050,7 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
 		}
 	}
 
-	return err ? err : nblocks;
+	return nblocks;
 }
 
 /**
Signature · 1 line
2.50.0
#1 lore raw
Quoted 8 lines · Colin Ian King

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,

Signature · 1 line
Leon Romanovsky <[email protected]>