]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net/mlx4_core: Use min3 to select number of MSI-X vectors
authoryuval.shaia@oracle.com <yuval.shaia@oracle.com>
Fri, 12 May 2017 06:10:51 +0000 (09:10 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 May 2017 18:20:26 +0000 (14:20 -0400)
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c

index 703205475524d689cd2762f2d2ce3abfd2b6ebcb..83aab1e4c8c8c76f73a598c5bdde51e185d9121a 100644 (file)
@@ -2862,12 +2862,10 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
        int port = 0;
 
        if (msi_x) {
-               int nreq = dev->caps.num_ports * num_online_cpus() + 1;
-
-               nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
-                            nreq);
-               if (nreq > MAX_MSIX)
-                       nreq = MAX_MSIX;
+               int nreq = min3(dev->caps.num_ports *
+                               (int)num_online_cpus() + 1,
+                               dev->caps.num_eqs - dev->caps.reserved_eqs,
+                               MAX_MSIX);
 
                entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
                if (!entries)