Skip to contentSkip to conversation

Fix a logic error in ahci_init_one()

PATCH In review zhao, forrest 2 participants 3 messages Apr 14, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a logic error in ahci_init_one()

Fix an bug in error handling, also variable
pci_dev_busy has no use, remove it.

---

This patch is against libata-dev.git upstream[1]

[1] 26ec634c31a11a003040e10b4d650495158632fd

 drivers/scsi/ahci.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/ahci.c +3 -6
index 1b8429c..8c4ebba 100644
@@ -1176,7 +1176,7 @@ static int ahci_init_one (struct pci_dev
 	unsigned long base;
 	void __iomem *mmio_base;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
-	int have_msi, pci_dev_busy = 0;
+	int have_msi;
 	int rc;
 
 	VPRINTK("ENTER\n");
@@ -1189,10 +1189,8 @@ static int ahci_init_one (struct pci_dev
 		return rc;
 
 	rc = pci_request_regions(pdev, DRV_NAME);
-	if (rc) {
-		pci_dev_busy = 1;
+	if (rc)
 		goto err_out;
-	}
 
 	if (pci_enable_msi(pdev) == 0)
 		have_msi = 1;
@@ -1269,8 +1267,7 @@ err_out_msi:
 		pci_intx(pdev, 0);
 	pci_release_regions(pdev);
 err_out:
-	if (!pci_dev_busy)
-		pci_disable_device(pdev);
+	pci_disable_device(pdev);
 	return rc;
 }
 
Signature · 1 line
1.2.6
#1 lore raw
Quoted 4 lines · forrest

Fix an bug in error handling, also variable
pci_dev_busy has no use, remove it.

What logic error do you see?

pci_dev_busy has a clear use, as illustrated by the code: if the PCI regions are reserved by another device, the device is in use, therefore we should avoid killing the device with pci_disable_device().

Jeff

#2 lore raw
Quoted 6 lines · Jeff Garzik
Quoted 4 lines · forrest

Fix an bug in error handling, also variable
pci_dev_busy has no use, remove it.

Quoted 7 lines

What logic error do you see?

pci_dev_busy has a clear use, as illustrated by the code: if the PCI regions are reserved by another device, the device is in use, therefore we should avoid killing the device with pci_disable_device().

Jeff

Oh, one PCI device can be probed by multiple drivers. It's first time for me to meet such case.
Please forgive my ignorance.

Forrest