[PATCH] intel_th: Simplify 'intel_th_pci_remove()'
From: Christophe JAILLET
Date: Sat Sep 18 2021 - 02:37:00 EST
'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@xxxxxxxxxx>
---
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