From patchwork Wed Sep 19 02:40:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 1475701 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 096FD3FCFC for ; Wed, 19 Sep 2012 02:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755290Ab2ISCmZ (ORCPT ); Tue, 18 Sep 2012 22:42:25 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:53077 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755259Ab2ISCmZ (ORCPT ); Tue, 18 Sep 2012 22:42:25 -0400 Received: from 172.24.2.119 (EHLO szxeml207-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id APF89227; Wed, 19 Sep 2012 10:42:20 +0800 (CST) Received: from SZXEML418-HUB.china.huawei.com (10.82.67.157) by szxeml207-edg.china.huawei.com (172.24.2.56) with Microsoft SMTP Server (TLS) id 14.1.323.3; Wed, 19 Sep 2012 10:41:20 +0800 Received: from localhost (10.135.76.84) by szxeml418-hub.china.huawei.com (10.82.67.157) with Microsoft SMTP Server id 14.1.323.3; Wed, 19 Sep 2012 10:41:11 +0800 From: Yijing Wang To: Bjorn Helgaas , Huang Ying , Chen Gong CC: , Hanjun Guo , , Yijing Wang Subject: [PATCH 5/6] PCI/AER: introduce pci_bus_ops_free to free pci_bus_ops Date: Wed, 19 Sep 2012 10:40:41 +0800 Message-ID: <1348022442-7816-6-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 In-Reply-To: <1348022442-7816-1-git-send-email-wangyijing@huawei.com> References: <1348022442-7816-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.76.84] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Signed-off-by: Yijing Wang --- 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) {