From patchwork Sun May 24 20:37:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 6472301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3CEF6C0020 for ; Sun, 24 May 2015 20:41:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 826ED20551 for ; Sun, 24 May 2015 20:41:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CBF920527 for ; Sun, 24 May 2015 20:41:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ywcek-0007fk-9W; Sun, 24 May 2015 20:37:58 +0000 Received: from hauke-m.de ([2001:41d0:8:b27b::1]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YwceS-0007bv-UZ for linux-arm-kernel@lists.infradead.org; Sun, 24 May 2015 20:37:45 +0000 Received: from hauke-desktop.fritz.box (pD9F6096E.dip0.t-ipconnect.de [217.246.9.110]) by hauke-m.de (Postfix) with ESMTPSA id E45E920267; Sun, 24 May 2015 22:37:17 +0200 (CEST) From: Hauke Mehrtens To: rjui@broadcom.com, bhelgaas@google.com Subject: [PATCH 2/2] PCI: iproc: free resource list after registration Date: Sun, 24 May 2015 22:37:03 +0200 Message-Id: <1432499823-27369-2-git-send-email-hauke@hauke-m.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432499823-27369-1-git-send-email-hauke@hauke-m.de> References: <1432499823-27369-1-git-send-email-hauke@hauke-m.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150524_133741_209695_D1C4CDC0 X-CRM114-Status: GOOD ( 10.20 ) X-Spam-Score: -0.0 (/) Cc: linux-pci@vger.kernel.org, zajec5@gmail.com, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Hauke Mehrtens X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The resource list is only used in the setup process and was never freed. pci_add_resource() allocates a memory area to store the list item. This patch fixes the memory leak. Signed-off-by: Hauke Mehrtens Reviewed-by: Ray Jui Tested-by: Ray Jui --- drivers/pci/host/pcie-iproc-bcma.c | 8 ++++---- drivers/pci/host/pcie-iproc-platform.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c index f96b39e..2e4f2d6 100644 --- a/drivers/pci/host/pcie-iproc-bcma.c +++ b/drivers/pci/host/pcie-iproc-bcma.c @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) pcie->map_irq = iproc_pcie_bcma_map_irq; ret = iproc_pcie_setup(pcie, &res); - if (ret) { + if (ret) dev_err(pcie->dev, "PCIe controller setup failed\n"); - return ret; - } - return 0; + pci_free_resource_list(&res); + + return ret; } static void iproc_pcie_bcma_remove(struct bcma_device *bdev) diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c index c5fe4c1..9aedc8e 100644 --- a/drivers/pci/host/pcie-iproc-platform.c +++ b/drivers/pci/host/pcie-iproc-platform.c @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) pcie->map_irq = of_irq_parse_and_map_pci; ret = iproc_pcie_setup(pcie, &res); - if (ret) { + if (ret) dev_err(pcie->dev, "PCIe controller setup failed\n"); - return ret; - } - return 0; + pci_free_resource_list(&res); + + return ret; } static int iproc_pcie_pltfm_remove(struct platform_device *pdev)