]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/mlx5: Use max() macro for bfreg calculation
authorRohit Chavan <roheetchavan@gmail.com>
Tue, 5 May 2026 10:05:49 +0000 (15:35 +0530)
committerLeon Romanovsky <leon@kernel.org>
Mon, 18 May 2026 08:58:41 +0000 (04:58 -0400)
Simplify the calculation of medium blue flame registers by using the
max() macro instead of open-coded ternary logic. This improves
readability and aligns with the subsystem's preference for using
standard kernel helpers.

Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
Link: https://patch.msgid.link/20260505100550.1810139-1-roheetchavan@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/mlx5/qp.c

index 8f50e7342a76949f7caf24f9ea32243ea60e2b83..3048d2d273d742a3069ff38f2747feb66c45cef1 100644 (file)
@@ -703,12 +703,8 @@ static int max_bfregs(struct mlx5_ib_dev *dev, struct mlx5_bfreg_info *bfregi)
 static int num_med_bfreg(struct mlx5_ib_dev *dev,
                         struct mlx5_bfreg_info *bfregi)
 {
-       int n;
-
-       n = max_bfregs(dev, bfregi) - bfregi->num_low_latency_bfregs -
-           NUM_NON_BLUE_FLAME_BFREGS;
-
-       return n >= 0 ? n : 0;
+       return max(0, max_bfregs(dev, bfregi) - bfregi->num_low_latency_bfregs -
+                             NUM_NON_BLUE_FLAME_BFREGS);
 }
 
 static int first_med_bfreg(struct mlx5_ib_dev *dev,