aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 95e188d0883e..a4c82fa71aec 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -319,6 +319,7 @@ static int mlx5_alloc_irq_vectors(struct mlx5_core_dev *dev)
319 struct mlx5_eq_table *table = &priv->eq_table; 319 struct mlx5_eq_table *table = &priv->eq_table;
320 int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq); 320 int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq);
321 int nvec; 321 int nvec;
322 int err;
322 323
323 nvec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() + 324 nvec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() +
324 MLX5_EQ_VEC_COMP_BASE; 325 MLX5_EQ_VEC_COMP_BASE;
@@ -328,21 +329,23 @@ static int mlx5_alloc_irq_vectors(struct mlx5_core_dev *dev)
328 329
329 priv->irq_info = kcalloc(nvec, sizeof(*priv->irq_info), GFP_KERNEL); 330 priv->irq_info = kcalloc(nvec, sizeof(*priv->irq_info), GFP_KERNEL);
330 if (!priv->irq_info) 331 if (!priv->irq_info)
331 goto err_free_msix; 332 return -ENOMEM;
332 333
333 nvec = pci_alloc_irq_vectors(dev->pdev, 334 nvec = pci_alloc_irq_vectors(dev->pdev,
334 MLX5_EQ_VEC_COMP_BASE + 1, nvec, 335 MLX5_EQ_VEC_COMP_BASE + 1, nvec,
335 PCI_IRQ_MSIX); 336 PCI_IRQ_MSIX);
336 if (nvec < 0) 337 if (nvec < 0) {
337 return nvec; 338 err = nvec;
339 goto err_free_irq_info;
340 }
338 341
339 table->num_comp_vectors = nvec - MLX5_EQ_VEC_COMP_BASE; 342 table->num_comp_vectors = nvec - MLX5_EQ_VEC_COMP_BASE;
340 343
341 return 0; 344 return 0;
342 345
343err_free_msix: 346err_free_irq_info:
344 kfree(priv->irq_info); 347 kfree(priv->irq_info);
345 return -ENOMEM; 348 return err;
346} 349}
347 350
348static void mlx5_free_irq_vectors(struct mlx5_core_dev *dev) 351static void mlx5_free_irq_vectors(struct mlx5_core_dev *dev)