Skip to contentSkip to conversation

ata: pata_macio: Fix PCI region leak

PATCH Applied Philipp Stanner 5 participants 5 messages Jun 10, 2025 – Jun 11, 2025 libata

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ata: pata_macio: Fix PCI region leak

pci_request_regions() became a managed devres functions if the PCI device was enabled with pcim_enable_device(), which is the case for pata_macio.

The PCI subsystem recently removed this hybrid feature from pci_request_region(). When doing so, pata_macio was forgotten to be ported to use pcim_request_all_regions(). If that function is not used, pata_macio will fail on driver-reload because the PCI regions will remain blocked.

Fix the region leak by replacing pci_request_regions() with its managed counterpart, pcim_request_all_regions().

Fixes 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request functions")

---
Changes in v2:
- Add Fixes: tag and rephrase commit message, since the merge window closed already. (Niklas)

---
 drivers/ata/pata_macio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_macio.c +1 -1
index fbf5f07ea357..f7a933eefe05 100644
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
 	priv->dev = &pdev->dev;
 
 	/* Get MMIO regions */
-	if (pci_request_regions(pdev, "pata-macio")) {
+	if (pcim_request_all_regions(pdev, "pata-macio")) {
 		dev_err(&pdev->dev,
 			"Cannot obtain PCI resources\n");
 		return -EBUSY;
Signature · 1 line
2.49.0
#1 lore raw
Quoted 11 lines · Philipp Stanner

pci_request_regions() became a managed devres functions if the PCI device was enabled with pcim_enable_device(), which is the case for pata_macio.

The PCI subsystem recently removed this hybrid feature from pci_request_region(). When doing so, pata_macio was forgotten to be ported to use pcim_request_all_regions(). If that function is not used,
pata_macio will fail on driver-reload because the PCI regions will remain blocked.

Quoted 7 lines

Fix the region leak by replacing pci_request_regions() with its managed
counterpart, pcim_request_all_regions().

Fixes 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request

functions")

Forgot Damien's Reviewed-by.

P.

Quoted 23 lines

---
Changes in v2:
  - Add Fixes: tag and rephrase commit message, since the merge window
    closed already. (Niklas)
---
 drivers/ata/pata_macio.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_macio.c +0 -0
index fbf5f07ea357..f7a933eefe05 100644
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev
 *pdev,
  	priv->dev = &pdev->dev;


  /* Get MMIO regions */

drivers/ata/pata_macio.c +1 -1
-	if (pci_request_regions(pdev, "pata-macio")) {
+	if (pcim_request_all_regions(pdev, "pata-macio")) {

  dev_err(&pdev->dev,
  "Cannot obtain PCI resources\n"); return -EBUSY;

#2 lore raw
Quoted 16 lines · Philipp Stanner
Quoted 15 lines · Philipp Stanner

pci_request_regions() became a managed devres functions if the PCI device was enabled with pcim_enable_device(), which is the case for pata_macio.

The PCI subsystem recently removed this hybrid feature from pci_request_region(). When doing so, pata_macio was forgotten to be ported to use pcim_request_all_regions(). If that function is not used,
pata_macio will fail on driver-reload because the PCI regions will remain blocked.

Fix the region leak by replacing pci_request_regions() with its managed
counterpart, pcim_request_all_regions().

Quoted 5 lines
Quoted 3 lines
Fixes 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request

functions")

Forgot Damien's Reviewed-by.

Then put it here, if maintainers use b4, it will automatically harvest them.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v2 1/1
#3 lore raw
In reply to Philipp Stanner
Quoted 10 lines · Philipp Stanner

pci_request_regions() became a managed devres functions if the PCI device was enabled with pcim_enable_device(), which is the case for pata_macio.

The PCI subsystem recently removed this hybrid feature from pci_request_region(). When doing so, pata_macio was forgotten to be ported to use pcim_request_all_regions(). If that function is not used, pata_macio will fail on driver-reload because the PCI regions will remain blocked.

Quoted 6 lines

Fix the region leak by replacing pci_request_regions() with its managed counterpart, pcim_request_all_regions().

Fixes 51f6aec99cb0 ("PCI: Remove hybrid devres nature from request functions")

---

Quoted 20 lines

Changes in v2:
- Add Fixes: tag and rephrase commit message, since the merge window closed already. (Niklas)

---
  drivers/ata/pata_macio.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_macio.c +1 -1
index fbf5f07ea357..f7a933eefe05 100644
@@ -1298,7 +1298,7 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
  	priv->dev = &pdev->dev;
 
  	/* Get MMIO regions */
-	if (pci_request_regions(pdev, "pata-macio")) {
+	if (pcim_request_all_regions(pdev, "pata-macio")) {
  		dev_err(&pdev->dev,
  			"Cannot obtain PCI resources\n");
  		return -EBUSY;
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
maintainer Applied
#4 lore raw
In reply to Philipp Stanner
Quoted 11 lines · Philipp Stanner

pci_request_regions() became a managed devres functions if the PCI device was enabled with pcim_enable_device(), which is the case for pata_macio.

The PCI subsystem recently removed this hybrid feature from pci_request_region(). When doing so, pata_macio was forgotten to be ported to use pcim_request_all_regions(). If that function is not used, pata_macio will fail on driver-reload because the PCI regions will remain blocked.

[...]

Applied to libata/linux.git (for-6.16-fixes), thanks!

[1/1] ata: pata_macio: Fix PCI region leak

      https://git.kernel.org/libata/linux/c/3e537877

Kind regards,
Niklas