]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] PCI Hotplug: fix CPCI reference counting bug
authorScott Murray <scottm@somanetworks.com>
Mon, 6 Jun 2005 19:48:04 +0000 (15:48 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Jun 2005 08:37:59 +0000 (01:37 -0700)
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>
drivers/pci/hotplug/cpci_hotplug_core.c
drivers/pci/hotplug/cpci_hotplug_pci.c

index 8132d946c384865287a3271358752aaf34a5e987..30af105271a2883d559c7ec89a2f5b0efe8f3ed6 100644 (file)
@@ -217,6 +217,8 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
        kfree(slot->hotplug_slot->info);
        kfree(slot->hotplug_slot->name);
        kfree(slot->hotplug_slot);
+       if (slot->dev)
+               pci_dev_put(slot->dev);
        kfree(slot);
 }
 
index c878028ad2151e9393ed93c0d3e86eca0738e62d..225b5e551dd6f53133b982087624b541310bc0ee 100644 (file)
@@ -315,9 +315,12 @@ int cpci_unconfigure_slot(struct slot* slot)
                                    PCI_DEVFN(PCI_SLOT(slot->devfn), i));
                if (dev) {
                        pci_remove_bus_device(dev);
-                       slot->dev = NULL;
+                       pci_dev_put(dev);
                }
        }
+       pci_dev_put(slot->dev);
+       slot->dev = NULL;
+
        dbg("%s - exit", __FUNCTION__);
        return 0;
 }