Skip to contentSkip to conversation

PCIE: cleanup on probe error

PATCH New Randy.Dunlap 1 participant 1 message Jul 7, 2006 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCIE: cleanup on probe error

From: Randy Dunlap <[email protected]>

If pcie_portdrv_probe() fails but it had already called pci_enable_device(), then call pci_disable_device() when returning error.

Is there some reason that this isn't being done?
or was it just missed?

---
 drivers/pci/pcie/portdrv_pci.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
drivers/pci/pcie/portdrv_pci.c +3 -1
@@ -73,8 +73,10 @@ static int __devinit pcie_portdrv_probe 
 		"%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 
 		__FUNCTION__, dev->device, dev->vendor);
 	}
-	if (pcie_port_device_register(dev)) 
+	if (pcie_port_device_register(dev)) {
+		pci_disable_device(dev);
 		return -ENOMEM;
+	}
 
 	return 0;
 }

---