From patchwork Mon Mar 20 22:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9635393 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F21660327 for ; Mon, 20 Mar 2017 22:49:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6088D23201 for ; Mon, 20 Mar 2017 22:49:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55513277D9; Mon, 20 Mar 2017 22:49:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D568923201 for ; Mon, 20 Mar 2017 22:49:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755818AbdCTWtw (ORCPT ); Mon, 20 Mar 2017 18:49:52 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:33157 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753610AbdCTWtv (ORCPT ); Mon, 20 Mar 2017 18:49:51 -0400 Received: by mail-pg0-f42.google.com with SMTP id n190so84252132pga.0 for ; Mon, 20 Mar 2017 15:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=1ANmi3o6qGrW5i+7YubT5bAsFOcu9UhUOOglsvMJKHo=; b=e2b/KGrhWRkEiLEL1Xct1BPczNKFWsBu0S58BbJRFxmH/W29Ln8MONIIacPUJZdzQB E/GHUUzrSs0Rui8X+wpmk2bv0tK6kfBSOgrFtjxEzQ9a8HN6oUHvP8jeHmg8Z7dIs0e6 RSmU0sFlk8yWTZzRObbrAQVj1o3IH1IbK7OQI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1ANmi3o6qGrW5i+7YubT5bAsFOcu9UhUOOglsvMJKHo=; b=HiHCQMn2L7QdwL3YCWGtqw6Abqt5GUA42iFhLk6ZDvH4TNjwFsRm98ZY5qZpt4J4MW XkTFc7pEleobSKv25VKpYmx1NJdZl24T23fm5Ldg286xvDBRdBw3vXnIx/MVPZlgjoE8 xRwsgwGQ7NlPv4kjKTWI5xkCwG/TKzdyHwAWgw+C+SNyUcHRTJx/+WYcHxHW+W5rLivn xVPzplJ87tEWAqkrUK15zwJiIbGjbUClViBSDxtoXfpv4QuXAR4XB5mEIx+eM57ePqxp xaalPW0K9F3GiB3LTakelJkzgK3OmtrqLtRXwlJmxrj/zDI4oOzh8UapwE4psJc8551T zjNQ== X-Gm-Message-State: AFeK/H068k4LY3jb4IWjgCXl8998GXct5rYT/knNVtNxDhs2OK/gmROk/maNOLl9HgHuyZaw X-Received: by 10.84.202.163 with SMTP id x32mr42702797pld.67.1490050190452; Mon, 20 Mar 2017 15:49:50 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id t70sm34945654pfe.64.2017.03.20.15.49.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 15:49:49 -0700 (PDT) From: Brian Norris To: Bjorn Helgaas Cc: , Shawn Lin , Jeffy Chen , Wenrui Li , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, Brian Norris Subject: [PATCH] PCI: rockchip: don't leak the PCI resource list Date: Mon, 20 Mar 2017 15:49:36 -0700 Message-Id: <20170320224936.28605-1-briannorris@chromium.org> X-Mailer: git-send-email 2.12.0.367.g23dc2f6d3c-goog Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This list is local to the probe() function. We should free it up in both the success case and the error case, but currently we're only freeing it in the error case (see commit f1d722b607d6 ("PCI: rockchip: Fix rockchip_pcie_probe() error path to free resource list")). Caught by kmemleak, when doing repeated bind/unbind tests. Signed-off-by: Brian Norris --- drivers/pci/host/pcie-rockchip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c index bd6df7254de4..8087a0698d65 100644 --- a/drivers/pci/host/pcie-rockchip.c +++ b/drivers/pci/host/pcie-rockchip.c @@ -1396,6 +1396,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev) goto err_free_res; } rockchip->root_bus = bus; + pci_free_resource_list(&res); pci_bus_size_bridges(bus); pci_bus_assign_resources(bus);