Loading arch/x86/pci/acpi.c +4 −17 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ struct pci_root_info { unsigned int res_num; unsigned int res_num; struct resource *res; struct resource *res; int busnum; int busnum; struct pci_sysdata sd; }; }; static bool pci_use_crs = true; static bool pci_use_crs = true; Loading Loading @@ -410,26 +411,16 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) if (node != -1 && !node_online(node)) if (node != -1 && !node_online(node)) node = -1; node = -1; /* Allocate per-root-bus (not per bus) arch-specific data. info = kzalloc(sizeof(*info), GFP_KERNEL); * TODO: leak; this memory is never freed. if (!info) { * It's arguable whether it's worth the trouble to care. */ sd = kzalloc(sizeof(*sd), GFP_KERNEL); if (!sd) { printk(KERN_WARNING "pci_bus %04x:%02x: " printk(KERN_WARNING "pci_bus %04x:%02x: " "ignored (out of memory)\n", domain, busnum); "ignored (out of memory)\n", domain, busnum); return NULL; return NULL; } } sd = &info->sd; sd->domain = domain; sd->domain = domain; sd->node = node; sd->node = node; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { kfree(sd); printk(KERN_WARNING "pci_bus %04x:%02x: " "ignored (out of memory)\n", domain, busnum); return NULL; } /* /* * Maybe the desired pci bus has been already scanned. In such case * Maybe the desired pci bus has been already scanned. In such case * it is unnecessary to scan the pci bus with the given domain,busnum. * it is unnecessary to scan the pci bus with the given domain,busnum. Loading @@ -442,7 +433,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) */ */ memcpy(bus->sysdata, sd, sizeof(*sd)); memcpy(bus->sysdata, sd, sizeof(*sd)); kfree(info); kfree(info); kfree(sd); } else { } else { probe_pci_root_info(info, device, busnum, domain); probe_pci_root_info(info, device, busnum, domain); Loading Loading @@ -484,9 +474,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) } } } } if (!bus) kfree(sd); if (bus && node != -1) { if (bus && node != -1) { #ifdef CONFIG_ACPI_NUMA #ifdef CONFIG_ACPI_NUMA if (pxm >= 0) if (pxm >= 0) Loading Loading
arch/x86/pci/acpi.c +4 −17 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,7 @@ struct pci_root_info { unsigned int res_num; unsigned int res_num; struct resource *res; struct resource *res; int busnum; int busnum; struct pci_sysdata sd; }; }; static bool pci_use_crs = true; static bool pci_use_crs = true; Loading Loading @@ -410,26 +411,16 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) if (node != -1 && !node_online(node)) if (node != -1 && !node_online(node)) node = -1; node = -1; /* Allocate per-root-bus (not per bus) arch-specific data. info = kzalloc(sizeof(*info), GFP_KERNEL); * TODO: leak; this memory is never freed. if (!info) { * It's arguable whether it's worth the trouble to care. */ sd = kzalloc(sizeof(*sd), GFP_KERNEL); if (!sd) { printk(KERN_WARNING "pci_bus %04x:%02x: " printk(KERN_WARNING "pci_bus %04x:%02x: " "ignored (out of memory)\n", domain, busnum); "ignored (out of memory)\n", domain, busnum); return NULL; return NULL; } } sd = &info->sd; sd->domain = domain; sd->domain = domain; sd->node = node; sd->node = node; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { kfree(sd); printk(KERN_WARNING "pci_bus %04x:%02x: " "ignored (out of memory)\n", domain, busnum); return NULL; } /* /* * Maybe the desired pci bus has been already scanned. In such case * Maybe the desired pci bus has been already scanned. In such case * it is unnecessary to scan the pci bus with the given domain,busnum. * it is unnecessary to scan the pci bus with the given domain,busnum. Loading @@ -442,7 +433,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) */ */ memcpy(bus->sysdata, sd, sizeof(*sd)); memcpy(bus->sysdata, sd, sizeof(*sd)); kfree(info); kfree(info); kfree(sd); } else { } else { probe_pci_root_info(info, device, busnum, domain); probe_pci_root_info(info, device, busnum, domain); Loading Loading @@ -484,9 +474,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) } } } } if (!bus) kfree(sd); if (bus && node != -1) { if (bus && node != -1) { #ifdef CONFIG_ACPI_NUMA #ifdef CONFIG_ACPI_NUMA if (pxm >= 0) if (pxm >= 0) Loading