Re: [PATCH] x86[-64] PCI domain support

From: Rolf Eike Beer
Date: Wed Sep 27 2006 - 03:27:57 EST


Jeff Garzik wrote:

> diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
> index b33aea8..e4f4828 100644
> --- a/arch/i386/pci/acpi.c
> +++ b/arch/i386/pci/acpi.c
> @@ -8,20 +8,37 @@ #include "pci.h"
> struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device,
> int domain, int busnum) {
> struct pci_bus *bus;
> + 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, not probing PCI bus %02x\n", busnum);
> + return NULL;
> + }
> +
> +#ifdef CONFIG_PCI_DOMAINS
> + sd->domain = domain;
> +#else
> if (domain != 0) {
> printk(KERN_WARNING "PCI: Multiple domains not supported\n");

kfree(sd);


> return NULL;
> }
> +#endif /* CONFIG_PCI_DOMAINS */

I would move this check to be done before the memory is allocated so we don't
need to free it.

Eike

Attachment: pgp00000.pgp
Description: PGP signature