Commit e2ac95ce authored by Matt Domsch's avatar Matt Domsch

dynids: free dynids on driver unload

parent 253e6815
......@@ -315,6 +315,22 @@ pci_init_dynids(struct pci_dynids *dynids)
INIT_LIST_HEAD(&dynids->list);
}
static void
pci_free_dynids(struct pci_driver *drv)
{
struct list_head *pos, *n;
struct dynid *dynid;
spin_lock(&drv->dynids.lock);
list_for_each_safe(pos, n, &drv->dynids.list) {
dynid = list_entry(pos, struct dynid, node);
list_del(&dynid->node);
kfree(dynid);
}
spin_unlock(&drv->dynids.lock);
}
/**
* pci_register_driver - register a new pci driver
* @drv: the driver structure to register
......@@ -363,6 +379,7 @@ void
pci_unregister_driver(struct pci_driver *drv)
{
driver_unregister(&drv->driver);
pci_free_dynids(drv);
}
static struct pci_driver pci_compat_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment