From patchwork Wed Dec 16 12:42:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jayachandran C." X-Patchwork-Id: 7861061 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 276AF9F1C2 for ; Wed, 16 Dec 2015 12:20:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C909203A5 for ; Wed, 16 Dec 2015 12:20:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAF6420396 for ; Wed, 16 Dec 2015 12:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932788AbbLPMUk (ORCPT ); Wed, 16 Dec 2015 07:20:40 -0500 Received: from mail-gw1-out.broadcom.com ([216.31.210.62]:33705 "EHLO mail-gw1-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932681AbbLPMUj (ORCPT ); Wed, 16 Dec 2015 07:20:39 -0500 X-IronPort-AV: E=Sophos;i="5.20,436,1444719600"; d="scan'208";a="83599426" Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw1-out.broadcom.com with ESMTP; 16 Dec 2015 06:45:35 -0800 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 16 Dec 2015 04:20:39 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.235.1; Wed, 16 Dec 2015 04:20:39 -0800 Received: from netl-snoppy.ban.broadcom.com (unknown [10.132.128.129]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id C7A8A4102F; Wed, 16 Dec 2015 04:17:05 -0800 (PST) From: Jayachandran C To: , Bjorn Helgaas , , Arnd Bergmann , CC: Jayachandran C , Lorenzo Pieralisi , Tomasz Nowicki 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 Message-ID: <1450269755-21420-4-git-send-email-jchandra@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450269755-21420-1-git-send-email-jchandra@broadcom.com> References: <1450269755-21420-1-git-send-email-jchandra@broadcom.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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. *