net/mlx4_core: Use min3 to select number of MSI-X vectors

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>
This commit is contained in:
yuval.shaia@oracle.com 2017-05-12 09:10:51 +03:00 committed by David S. Miller
parent 70957eaecc
commit 4762010f09
1 changed files with 4 additions and 6 deletions

View 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)