Signed-off-by: Yijing Wang <wangyijing@xxxxxxxxxx> --- drivers/pci/pcie/aer/aer_inject.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 0a12ac7..79b611d 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c @@ -162,6 +162,16 @@ static struct pci_bus_ops *pci_bus_ops_pop(void) return bus_ops; } +static void pci_bus_ops_free(void) +{ + struct pci_bus_ops *bus_ops, *tmp_ops; + + list_for_each_entry_safe(bus_ops, tmp_ops, &pci_bus_ops_list, list) { + list_del(&bus_ops->list); + kfree(bus_ops); + } +} + static struct pci_bus_ops *pci_bus_ops_get(struct pci_bus_ops *from) { struct pci_bus_ops *bus_ops = NULL; @@ -641,9 +651,7 @@ static void __exit aer_inject_exit(void) * module exit */ clean_untracked_pci_ops_aer(); - - while ((bus_ops = pci_bus_ops_pop())) - kfree(bus_ops); + pci_bus_ops_free(); spin_lock_irqsave(&inject_lock, flags); list_for_each_entry_safe(err, err_next, &einjected, list) { -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html