Skip to contentSkip to conversation

: powerpc/pseries: bugfix: balance calls to pci_device_put

PATCH New Linas Vepstas 1 participant 1 message Apr 6, 2006

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

PATCH 1/1 : powerpc/pseries: bugfix: balance calls to pci_device_put

[PATCH]: powerpc/pseries: bugfix: balance calls to pci_device_put

Repeated calls to eeh_remove_device() can result in multiple (and thus unbalanced) calls to pci_dev_put(). Make sure the pci_device_put() is called only once (since there was only one call to the matching pci_device_get()).

----

 arch/powerpc/platforms/pseries/eeh.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh.c +4 -2
Index: linux-2.6.17-rc1/arch/powerpc/platforms/pseries/eeh.c
===================================================================
@@ -957,8 +957,10 @@ static void eeh_remove_device(struct pci
 	pci_addr_cache_remove_device(dev);
 
 	dn = pci_device_to_OF_node(dev);
-	PCI_DN(dn)->pcidev = NULL;
-	pci_dev_put (dev);
+	if (PCI_DN(dn)->pcidev) {
+		PCI_DN(dn)->pcidev = NULL;
+		pci_dev_put (dev);
+	}
 }
 
 void eeh_remove_bus_device(struct pci_dev *dev)