lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <5a22ea4178d5142e4274da5eff3cedc1252a1797.1631946926.git.christophe.jaillet@wanadoo.fr>
Date:   Sat, 18 Sep 2021 08:36:22 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     alexander.shishkin@...ux.intel.com
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] intel_th: Simplify 'intel_th_pci_remove()'

'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@...adoo.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ