Skip to contentSkip to conversation

net/mlx5: Fix check for allocation failure in comp_irqs_request_pci()

PATCH RESEND New Dan Carpenter 1 participant 1 message May 19, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 net/mlx5: Fix check for allocation failure in comp_irqs_request_pci()

This function accidentally dereferences "cpus" instead of returning directly.

Fixes b48a0f72bc3e ("net/mlx5: Refactor completion irq request/release code")

---
I sent this earlier, but it wasn't applied and the kbuild caught it.
https://lore.kernel.org/all/[email protected]/

 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/eq.c +1 -1
index eb41f0abf798..13491246c9e9 100644
@@ -824,7 +824,7 @@ static int comp_irqs_request_pci(struct mlx5_core_dev *dev)
 	ncomp_eqs = table->num_comp_eqs;
 	cpus = kcalloc(ncomp_eqs, sizeof(*cpus), GFP_KERNEL);
 	if (!cpus)
-		ret = -ENOMEM;
+		return -ENOMEM;
 
 	i = 0;
 	rcu_read_lock();
Signature · 1 line
2.39.1