Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4762010f authored by yuval.shaia@oracle.com's avatar yuval.shaia@oracle.com Committed by David S. Miller
Browse files

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

parent 70957eae
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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)