From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41vB971x8ZzDrb6 for ; Mon, 20 Aug 2018 21:17:14 +1000 (AEST) Received: by mail-qt0-f193.google.com with SMTP id z8-v6so15681718qto.9 for ; Mon, 20 Aug 2018 04:17:14 -0700 (PDT) MIME-Version: 1.0 References: <20180817102645.3839621-1-arnd@arndb.de> <20180817102645.3839621-9-arnd@arndb.de> In-Reply-To: From: Arnd Bergmann Date: Mon, 20 Aug 2018 13:16:55 +0200 Message-ID: Subject: Re: [RFC 08/15] x86: PCI: clean up pcibios_scan_root() To: Rafael Wysocki Cc: linux-pci , Bjorn Helgaas , Linux Kernel Mailing List , Christoph Hellwig , Lorenzo Pieralisi , Benjamin Herrenschmidt , linuxppc-dev , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, Aug 20, 2018 at 10:31 AM Rafael J. Wysocki wrote: > On Fri, Aug 17, 2018 at 12:32 PM Arnd Bergmann wrote: > > -static struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, > > - struct pci_ops *ops, void *sysdata, struct list_head *resources) > > +void pcibios_scan_root(int busnum) > > { > > + struct pci_sysdata *sd; > > struct pci_host_bridge *bridge; > > int error; > > > > - bridge = pci_alloc_host_bridge(0); > > - if (!bridge) > > - return NULL; > > + bridge = pci_alloc_host_bridge(sizeof(sd)); > > + if (!bridge) { > > + printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum); > > + return; > > + } > > + sd = pci_host_bridge_priv(bridge); > > This looks fishy, as bridge->private is not set at this point AFAICS, > unless one of the previous patches changes that. bridge->private what comes after the bridge structure, and it's allocated by pci_alloc_host_bridge() passing the size of the structure we want for this private area. Arnd