From patchwork Fri Aug 10 06:11:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 1304121 Return-Path: X-Original-To: patchwork-linux-acpi@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 EF66F3FCF2 for ; Fri, 10 Aug 2012 06:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754201Ab2HJGL7 (ORCPT ); Fri, 10 Aug 2012 02:11:59 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:51427 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753667Ab2HJGL6 (ORCPT ); Fri, 10 Aug 2012 02:11:58 -0400 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 571A13EE0BD; Fri, 10 Aug 2012 15:11:57 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 3E7BE45DE7E; Fri, 10 Aug 2012 15:11:57 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 258FB45DEB4; Fri, 10 Aug 2012 15:11:57 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 159851DB803F; Fri, 10 Aug 2012 15:11:57 +0900 (JST) Received: from m005.s.css.fujitsu.com (m005.s.css.fujitsu.com [10.23.4.35]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id C4C641DB803E; Fri, 10 Aug 2012 15:11:56 +0900 (JST) Received: from m005.css.fujitsu.com (m005 [127.0.0.1]) by m005.s.css.fujitsu.com (Postfix) with ESMTP id 97B0C50EC9F; Fri, 10 Aug 2012 15:11:54 +0900 (JST) Received: from DEUCALION (unknown [10.124.101.32]) by m005.s.css.fujitsu.com (Postfix) with SMTP id 49A4850ECA9; Fri, 10 Aug 2012 15:11:54 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Date: Fri, 10 Aug 2012 15:11:50 +0900 From: Taku Izumi To: Taku Izumi Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, linux-acpi@vger.kernel.org, kaneshige.kenji@jp.fujitsu.com, yinghai@kernel.org, jiang.liu@huawei.com Subject: [PATCH 1/7][RESEND] x86, PCI: Fix non acpi path pci_sysdata leaking with release_fn Message-Id: <20120810151150.a3942c58.izumi.taku@jp.fujitsu.com> In-Reply-To: <20120810150955.e4ab3c7f.izumi.taku@jp.fujitsu.com> References: <20120810150955.e4ab3c7f.izumi.taku@jp.fujitsu.com> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Yinghai Lu x86, PCI: Fix non acpi path pci_sysdata leaking with release_fn Non acpi path, or root is not probed from acpi, during root bus removal will get warning about leaking from pci_scan_bus_on_node. Fix it with setting pci_host_bridge release function. Signed-off-by: Yinghai Lu Signed-off-by: Taku Izumi --- arch/x86/pci/common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: Bjorn-next-0808/arch/x86/pci/common.c =================================================================== --- Bjorn-next-0808.orig/arch/x86/pci/common.c +++ Bjorn-next-0808/arch/x86/pci/common.c @@ -634,17 +634,19 @@ int pci_ext_cfg_avail(struct pci_dev *de return 0; } +static void release_pci_sysdata(struct pci_host_bridge *bridge) +{ + struct pci_sysdata *sd = bridge->release_data; + + kfree(sd); +} + struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) { LIST_HEAD(resources); struct pci_bus *bus = NULL; struct pci_sysdata *sd; - /* - * Allocate per-root-bus (not per bus) arch-specific data. - * TODO: leak; this memory is never freed. - * It's arguable whether it's worth the trouble to care. - */ sd = kzalloc(sizeof(*sd), GFP_KERNEL); if (!sd) { printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno); @@ -654,7 +656,10 @@ struct pci_bus * __devinit pci_scan_bus_ x86_pci_root_bus_resources(busno, &resources); printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno); bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources); - if (!bus) { + if (bus) + pci_set_host_bridge_release(to_pci_host_bridge(bus->bridge), + release_pci_sysdata, sd); + else { pci_free_resource_list(&resources); kfree(sd); }