aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorScott Murray <scottm@somanetworks.com>2005-06-06 15:48:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-09 04:37:59 -0400
commit03e49d40ea3436cae0fe43708f11584130ee4a0c (patch)
treeacaa11b11c0ff1d4c9f743c0d8df2bc5a865a440 /drivers
parent5273a00d9c763108397658d440618f7ac3e40f83 (diff)
[PATCH] PCI Hotplug: fix CPCI reference counting bug
Here's a patch that fixes up the pci_dev refcounting in the CPCI code. I've done some testing against it and it seems fine here. Signed-off-by: Scott Murray <scottm@somanetworks.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c2
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 8132d946c384..30af105271a2 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
217 kfree(slot->hotplug_slot->info); 217 kfree(slot->hotplug_slot->info);
218 kfree(slot->hotplug_slot->name); 218 kfree(slot->hotplug_slot->name);
219 kfree(slot->hotplug_slot); 219 kfree(slot->hotplug_slot);
220 if (slot->dev)
221 pci_dev_put(slot->dev);
220 kfree(slot); 222 kfree(slot);
221} 223}
222 224
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index c878028ad215..225b5e551dd6 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* slot)
315 PCI_DEVFN(PCI_SLOT(slot->devfn), i)); 315 PCI_DEVFN(PCI_SLOT(slot->devfn), i));
316 if (dev) { 316 if (dev) {
317 pci_remove_bus_device(dev); 317 pci_remove_bus_device(dev);
318 slot->dev = NULL; 318 pci_dev_put(dev);
319 } 319 }
320 } 320 }
321 pci_dev_put(slot->dev);
322 slot->dev = NULL;
323
321 dbg("%s - exit", __FUNCTION__); 324 dbg("%s - exit", __FUNCTION__);
322 return 0; 325 return 0;
323} 326}