From nobody Fri Dec 19 17:39:41 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2BC926CE01; Tue, 24 Jun 2025 17:50:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750787423; cv=none; b=VANz3EXffHF4RCAM+kED2jthkznKuykBNuEmFqImAjPIelOMbudRxwAelfOr5UbGtI2RHkax656vjH5IAqFkSZERA6sMMpkfyAe5LCUvfHKxIsnd2eEO/KMbdUILT8IJHZCuKzY2E+75shuLP4G00Se0kbZauQDq4sFRPz7lnpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750787423; c=relaxed/simple; bh=1cPt35KT7h8xbHwIRCooNcsIXVw5ckbfWqgtXPCCV+w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DkE4ztQUNnZ8QHxV8+GAGsGZ8IGYcr5zWJ4vaDwClOwDmLdjYfyGXcDPibC1jeFFbKh3i6taOv3Sk+lhVcqsixIJploi3VXmmIm4njrLv/DRdPIpR37kp1c/3pR/aosouOioknnvB3eaZnO2yEFpQtPpr37R3rb/ET8jkJKNeb4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32738C4CEE3; Tue, 24 Jun 2025 17:50:20 +0000 (UTC) From: Geert Uytterhoeven To: Marc Zyngier , Alyssa Rosenzweig , Rob Herring , Manivannan Sadhasivam , Will Deacon , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Bjorn Helgaas , Conor Dooley , Daire McNamara Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] PCI: host-generic: Set driver_data before calling gen_pci_init() Date: Tue, 24 Jun 2025 19:50:10 +0200 Message-ID: <774290708a6f0f683711914fda110742c18a7fb2.1750787223.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On MicroChip MPFS Icicle: microchip-pcie 2000000000.pcie: host bridge /soc/pcie@2000000000 ranges: microchip-pcie 2000000000.pcie: Parsing ranges property... microchip-pcie 2000000000.pcie: MEM 0x2008000000..0x2087ffffff -> = 0x0008000000 Unable to handle kernel NULL pointer dereference at virtual address 000= 0000000000368 Current swapper/0 pgtable: 4K pagesize, 39-bit VAs, pgdp=3D0x0000000081= 4f1000 [0000000000000368] pgd=3D0000000000000000, p4d=3D0000000000000000, pud= =3D0000000000000000 Oops [#1] Modules linked in: CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.15.0-rc1-icicle-0000= 3-gafc0a570bb61 #232 NONE Hardware name: Microchip PolarFire-SoC Icicle Kit (DT) [...] [] plda_pcie_setup_iomems+0xe/0x78 [] mc_platform_init+0x80/0x1d2 [] pci_ecam_create+0x104/0x1e2 [] pci_host_common_init+0x120/0x228 [] pci_host_common_probe+0x7c/0x8a The initialization of driver_data was moved after the call to gen_pci_init(), while the pci_ecam_ops.init() callback mc_platform_init() expects it has already been initialized. Fix this by moving the initialization of driver_data up. Fixes: afc0a570bb613871 ("PCI: host-generic: Extract an ECAM bridge creatio= n helper from pci_host_common_probe()") Signed-off-by: Geert Uytterhoeven --- Notes: 1. Before, driver_data was initialized before calling of_pci_check_probe_only(), but the latter doesn't rely on that, 2. drivers/pci/controller/plda/pcie-microchip-host.c seems to be the only driver relying on driver_data being set. --- drivers/pci/controller/pci-host-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/control= ler/pci-host-common.c index b0992325dd65f0da..b37052863847162d 100644 --- a/drivers/pci/controller/pci-host-common.c +++ b/drivers/pci/controller/pci-host-common.c @@ -64,13 +64,13 @@ int pci_host_common_init(struct platform_device *pdev, =20 of_pci_check_probe_only(); =20 + platform_set_drvdata(pdev, bridge); + /* Parse and map our Configuration Space windows */ cfg =3D gen_pci_init(dev, bridge, ops); if (IS_ERR(cfg)) return PTR_ERR(cfg); =20 - platform_set_drvdata(pdev, bridge); - bridge->sysdata =3D cfg; bridge->ops =3D (struct pci_ops *)&ops->pci_ops; bridge->enable_device =3D ops->enable_device; --=20 2.43.0