All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] intel_th: Simplify 'intel_th_pci_remove()'
@ 2021-09-18  6:36 Christophe JAILLET
  0 siblings, 0 replies; only message in thread
From: Christophe JAILLET @ 2021-09-18  6:36 UTC (permalink / raw)
  To: alexander.shishkin; +Cc: linux-kernel, kernel-janitors, Christophe JAILLET

'pci_free_irq_vectors()' is called in the remove function, but not in the
error handling path of the probe function.

In fact, it can be removed from the remove function because
'pcim_enable_device()' registers the 'pcim_release()' release function.
This function already does the needed clean-up.

While at it, document how resources allocated by 'pci_alloc_irq_vectors()'
are freed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This is only a clean-up patch.
Calling 'pci_alloc_irq_vectors()' and doing the same via 'pcim_release()'
is harmless.
---
 drivers/hwtracing/intel_th/pci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c
index 7da4f298ed01..fd7adeea8ebe 100644
--- a/drivers/hwtracing/intel_th/pci.c
+++ b/drivers/hwtracing/intel_th/pci.c
@@ -92,6 +92,7 @@ static int intel_th_pci_probe(struct pci_dev *pdev,
 		r++;
 	}
 
+	/* Freed by the release function registered by pcim_enable_device() */
 	err = pci_alloc_irq_vectors(pdev, 1, 8, PCI_IRQ_ALL_TYPES);
 	if (err > 0)
 		for (i = 0; i < err; i++, r++) {
@@ -116,8 +117,6 @@ static void intel_th_pci_remove(struct pci_dev *pdev)
 	struct intel_th *th = pci_get_drvdata(pdev);
 
 	intel_th_free(th);
-
-	pci_free_irq_vectors(pdev);
 }
 
 static const struct intel_th_drvdata intel_th_1x_multi_is_broken = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-18  6:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18  6:36 [PATCH] intel_th: Simplify 'intel_th_pci_remove()' Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.