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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: pgpdEJVKrnZAe.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux