Skip to content

Commit

Permalink
octeontx2-af: cn10k: mcs: Fix a resource leak in the probe and remove…
Browse files Browse the repository at this point in the history
… functions

In mcs_register_interrupts(), a call to request_irq() is not balanced by a
corresponding free_irq(), neither in the error handling path, nor in the
remove function.

Add the missing calls.

Fixes: 6c635f7 ("octeontx2-af: cn10k: mcs: Handle MCS block interrupts")
Signed-off-by: Christophe JAILLET <[email protected]>
Link: https://lore.kernel.org/r/69f153db5152a141069f990206e7389f961d41ec.1670693669.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
tititiou36 authored and kuba-moo committed Dec 12, 2022
1 parent a38a211 commit 87c9781
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/marvell/octeontx2/af/mcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,13 @@ static int mcs_register_interrupts(struct mcs *mcs)
mcs->tx_sa_active = alloc_mem(mcs, mcs->hw->sc_entries);
if (!mcs->tx_sa_active) {
ret = -ENOMEM;
goto exit;
goto free_irq;
}

return ret;

free_irq:
free_irq(pci_irq_vector(mcs->pdev, MCS_INT_VEC_IP), mcs);
exit:
pci_free_irq_vectors(mcs->pdev);
mcs->num_vec = 0;
Expand Down Expand Up @@ -1589,6 +1592,7 @@ static void mcs_remove(struct pci_dev *pdev)

/* Set MCS to external bypass */
mcs_set_external_bypass(mcs, true);
free_irq(pci_irq_vector(pdev, MCS_INT_VEC_IP), mcs);
pci_free_irq_vectors(pdev);
pci_release_regions(pdev);
pci_disable_device(pdev);
Expand Down

0 comments on commit 87c9781

Please sign in to comment.