From: Jayachandran C <jchandra@broadcom.com>
To: <linux-pci@vger.kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,
<linux-acpi@vger.kernel.org>, Arnd Bergmann <arnd@arndb.de>,
<linux-arm-kernel@lists.infradead.org>
Cc: Jayachandran C <jchandra@broadcom.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Tomasz Nowicki <tn@semihalf.com>
Subject: [RFC PATCH v3 3/5] PCI: Handle NULL parent in pci_bus_assign_domain_nr
Date: Wed, 16 Dec 2015 18:12:33 +0530 [thread overview]
Message-ID: <1450269755-21420-4-git-send-email-jchandra@broadcom.com> (raw)
In-Reply-To: <1450269755-21420-1-git-send-email-jchandra@broadcom.com>
pci_create_root_bus is called with NULL as parent in ACPI. On arm64
this ends up calling pci_bus_assign_domain_nr, which crashes when
dereferencing parent.
To fix this, update pci_bus_assign_domain_nr to return if parent is
NULL. Setting up the domain number will be handled from
pcibios_root_bridge_prepare on arm64 when booted with ACPI.
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
drivers/pci/pci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 314db8c..a96c356 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4772,8 +4772,13 @@ int pci_get_new_domain_nr(void)
void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent)
{
static int use_dt_domains = -1;
- int domain = of_get_pci_domain_nr(parent->of_node);
+ int domain;
+ /* in case of ACPI, parent is NULL */
+ if (parent == NULL)
+ return;
+
+ domain = of_get_pci_domain_nr(parent->of_node);
/*
* Check DT domain and use_dt_domains values.
*
--
1.9.1
next prev parent reply other threads:[~2015-12-16 12:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 12:42 [RFC PATCH v3 0/5] Simple ACPI based PCI support for arm64 Jayachandran C
2015-12-16 12:42 ` [RFC PATCH v3 1/5] ACPI: MCFG: Move mmcfg_list management to drivers/acpi Jayachandran C
2015-12-16 12:42 ` [RFC PATCH v3 2/5] arm64: pci: Add ACPI support Jayachandran C
2015-12-16 14:24 ` Arnd Bergmann
2015-12-16 12:42 ` Jayachandran C [this message]
2015-12-16 12:42 ` [RFC PATCH v3 4/5] ACPI: PCI: Support platforms that need pci_remap_iospace Jayachandran C
2015-12-16 12:42 ` [RFC PATCH v3 5/5] PCI: ACPI: Add a generic ACPI based host controller Jayachandran C
2015-12-18 10:35 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450269755-21420-4-git-send-email-jchandra@broadcom.com \
--to=jchandra@broadcom.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=tn@semihalf.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).