Re: [PATCH v6 09/30] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Suravee Suthikulpanit <Suravee.Suthikulpanit@xxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
- Subject: Re: [PATCH v6 09/30] PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
- From: Yijing Wang <wangyijing@xxxxxxxxxx>
- Date: Mon, 23 Mar 2015 09:08:41 +0800
- Cc: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>, <linux-pci@xxxxxxxxxxxxxxx>, Yinghai Lu <yinghai@xxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, Marc Zyngier <marc.zyngier@xxxxxxx>, <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxxx>, <x86@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Rusty Russell <rusty@xxxxxxxxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, <linux-ia64@xxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, "Guan Xuetao" <gxt@xxxxxxxxxxxxxxx>, <linux-alpha@xxxxxxxxxxxxxxx>, <linux-m68k@xxxxxxxxxxxxxxx>, Liviu Dudau <liviu@xxxxxxxxxxx>, "Arnd Bergmann" <arnd@xxxxxxxx>, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- In-reply-to: <550DFD13.9080505@amd.com>
- List-id: <linux-ia64.vger.kernel.org>
- References: <1425868467-9667-1-git-send-email-wangyijing@huawei.com> <1425868467-9667-10-git-send-email-wangyijing@huawei.com> <550DFD13.9080505@amd.com>
- User-agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.0.1
>> +struct pci_host_bridge *pci_create_host_bridge(
>> + struct device *parent, u32 db, struct list_head *resources)
>> +{
>> + int error;
>> + int bus = PCI_BUSNUM(db);
>> + int domain = PCI_DOMAIN(db);
>> + struct pci_host_bridge *host;
>> + struct resource_entry *window, *n;
>> +
>> + host = kzalloc(sizeof(*host), GFP_KERNEL);
>> + if (!host)
>> + return NULL;
>> +
>> + host->busnum = bus;
>> + host->domain = domain;
>> + /* If support CONFIG_PCI_DOMAINS_GENERIC, use
>> + * pci_host_assign_domain_nr() to assign domain
>> + * number instead PCI_DOMAIN(db).
>> + */
>> + pci_host_assign_domain_nr(host);
>
> At this point, host->dev.parent has not been assigned. However, when calling pci_host_assign_domain_nr(host), it calls pci_assign_domain_nr(host->dev.parent), which uses parent->of_node directly w/o checking if parent is NULL. This ended up causing NULL pointer exception when I do the test.
>
> I think we need to moveo host->dev.parent = parent before calling pci_host_assign_domain_nr(host).
Good catch! Hi Suravee, thanks for your test, I would assign host->dev.parent before pci_host_assign_domain_nr().
Thanks!
Yijing.
>
> .
>
--
Thanks!
Yijing
--
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]