public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Use clamp() in _mlx5r_umr_zap_mkey()
@ 2026-03-10 14:57 Thorsten Blum
  2026-03-10 18:47 ` Leon Romanovsky
  2026-03-10 21:24 ` David Laight
  0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-03-10 14:57 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe; +Cc: Thorsten Blum, linux-rdma, linux-kernel

Replace min(max()) with clamp(). No functional change.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 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 4e562e0dd9e1..1a6b0ac5c24d 100644
--- a/drivers/infiniband/hw/mlx5/umr.c
+++ b/drivers/infiniband/hw/mlx5/umr.c
@@ -1013,7 +1013,7 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
 		 MLX5_IB_UPD_XLT_ATOMIC;
 	max_log_size = get_max_log_entity_size_cap(dev, access_mode);
 	max_page_shift = order_base_2(mr->ibmr.length);
-	max_page_shift = min(max(max_page_shift, page_shift), max_log_size);
+	max_page_shift = clamp(max_page_shift, page_shift, max_log_size);
 	/* Count blocks in units of max_page_shift, we will zap exactly this
 	 * many to make the whole MR non-present.
 	 * Block size must be aligned to MLX5_UMR_FLEX_ALIGNMENT since it may

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

end of thread, other threads:[~2026-03-11  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 14:57 [PATCH] RDMA/mlx5: Use clamp() in _mlx5r_umr_zap_mkey() Thorsten Blum
2026-03-10 18:47 ` Leon Romanovsky
2026-03-10 19:30   ` Thorsten Blum
2026-03-10 21:24 ` David Laight
2026-03-11  8:32   ` Leon Romanovsky

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