From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794590744; b=22Um18nEJvpw4gJyvAL2xR0dD6nqo4MPkkUOgx7pzm0QYIU5dR/+YP2yNBz1LzbYdkQE KESvdRpUkvkMpjcRtj3TdwVU40vaG7VpcspJTeK3RuIegU1pNLwYlTKI1WgnbQoznZGi6 dpX8dK2BC9yI3AzMOQXSA3OXlbM3JOnU56qP8O0osdYeGN3/rqiVu3WT3DV3IyLNALoKS pQDJN/y5+dZhgmRk8m2NJ28A8NBc+juSJIFIQb/+sshWyWFXpTPfC0y/VV4ENMzU02rZh Z/dK8MjJCqmOvqvzgGAVRz4/4lqLfM+5QgTmPkJye5nmReRVbEZERNnJ0oXe19NLkjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794590744; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=FdxYTIyeJea7zJO25weEDNXbkXMtYl+UJLMOjqT4+ZM=; b=PqFXOyYKYQsXcKYAuFyz4aKajZhElpamnEfbveM0y+pZZVSA5+JuBvBOae0MdMMi8pqY mvrdKCSoO0JxV1eTWomRsWsONQAMEv/cvCbGEhdFt3cf/4f9fOvupqH5dEqRdK5/j4bdB gwvRng24BJqpU48LTxaD9Lvz0VNKcSTr0DU0XkuL3SbnA69zaw7X0UfM/+QfXPZsXAs5B 5fk3KjEL5hgyWBK2sakG5G1rolZlbIPZRk55Yy8a6+q06aNPiZJiw02dy0AWGkiWCHX19 eIgNx6JXmPEFk6LX1+Yc/IraEZ5lkCvqFxEs06euz6AqA3EfOYgtq1fezTCMfCHHlXA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BZJFCLaE; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10AC0607B5A3; Fri, 13 Nov 2026 17:25:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=BZJFCLaE Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1C0F1F000C4; Fri, 13 Nov 2026 17:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794590743; bh=FdxYTIyeJea7zJO25weEDNXbkXMtYl+UJLMOjqT4+ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BZJFCLaEpaT1DHlgIWOlcfgUhkQKX4VjQFmKLbyYkXhtpc3F9cOFKqxL+4DzUvQiv z02D7qZttPXtQy1k586mfXmmtu4I97ipY/DN4g7NuXZP2Hj73IvE2cozHIcA2C9zj/ bYwf3FXZUeQMtUhs1bsjDsakRSXEtNivm231Fjh4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linmao Li , Manivannan Sadhasivam , Bjorn Helgaas , Aksh Garg , Sasha Levin Subject: [PATCH 6.18 644/686] PCI: cadence: Store the core controller in platform drvdata Date: Fri, 13 Nov 2026 10:52:57 -0500 Message-ID: <20261113153843.606097713@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261113153820.902362109@linuxfoundation.org> References: <20261113153820.902362109@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linmao Li [ Upstream commit cfe96ce583c51bf6e034d4038c652a1e8227867c ] cdns_plat_pcie_probe() stores a struct cdns_plat_pcie pointer with platform_set_drvdata(). cdns_plat_pcie_shutdown() and the callbacks in cdns_pcie_pm_ops retrieve the same pointer with dev_get_drvdata() but use it as a struct cdns_pcie pointer. This makes them read phy_count and phy beyond the wrapper. struct cdns_plat_pcie only contains a pointer to struct cdns_pcie. Drop the redundant wrapper and store the struct cdns_pcie pointer directly. Fixes: bd22885aa188 ("PCI: cadence: Refactor driver to use as a core library") Signed-off-by: Linmao Li Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Reviewed-by: Aksh Garg Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260915082826.4135665-1-lilinmao@kylinos.cn [ sashal: adapted the retained PHY-link cleanup loop to use pcie directly instead of the removed wrapper ] Signed-off-by: Sasha Levin --- .../controller/cadence/pcie-cadence-plat.c | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c index 0456845dabb96..c1ec619ab0a4e 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-plat.c +++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c @@ -14,14 +14,6 @@ #define CDNS_PLAT_CPU_TO_BUS_ADDR 0x0FFFFFFF -/** - * struct cdns_plat_pcie - private data for this PCIe platform driver - * @pcie: Cadence PCIe controller - */ -struct cdns_plat_pcie { - struct cdns_pcie *pcie; -}; - struct cdns_plat_pcie_of_data { bool is_rc; }; @@ -40,9 +32,9 @@ static const struct cdns_pcie_ops cdns_plat_ops = { static int cdns_plat_pcie_probe(struct platform_device *pdev) { const struct cdns_plat_pcie_of_data *data; - struct cdns_plat_pcie *cdns_plat_pcie; struct device *dev = &pdev->dev; struct pci_host_bridge *bridge; + struct cdns_pcie *pcie; struct cdns_pcie_ep *ep; struct cdns_pcie_rc *rc; int phy_count; @@ -56,11 +48,6 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) is_rc = data->is_rc; pr_debug(" Started %s with is_rc: %d\n", __func__, is_rc); - cdns_plat_pcie = devm_kzalloc(dev, sizeof(*cdns_plat_pcie), GFP_KERNEL); - if (!cdns_plat_pcie) - return -ENOMEM; - - platform_set_drvdata(pdev, cdns_plat_pcie); if (is_rc) { if (!IS_ENABLED(CONFIG_PCIE_CADENCE_PLAT_HOST)) return -ENODEV; @@ -72,9 +59,9 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) rc = pci_host_bridge_priv(bridge); rc->pcie.dev = dev; rc->pcie.ops = &cdns_plat_ops; - cdns_plat_pcie->pcie = &rc->pcie; + pcie = &rc->pcie; - ret = cdns_pcie_init_phy(dev, cdns_plat_pcie->pcie); + ret = cdns_pcie_init_phy(dev, pcie); if (ret) { dev_err(dev, "failed to init phy\n"); return ret; @@ -99,9 +86,9 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) ep->pcie.dev = dev; ep->pcie.ops = &cdns_plat_ops; - cdns_plat_pcie->pcie = &ep->pcie; + pcie = &ep->pcie; - ret = cdns_pcie_init_phy(dev, cdns_plat_pcie->pcie); + ret = cdns_pcie_init_phy(dev, pcie); if (ret) { dev_err(dev, "failed to init phy\n"); return ret; @@ -119,18 +106,20 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev) goto err_init; } + platform_set_drvdata(pdev, pcie); + return 0; err_init: err_get_sync: pm_runtime_put_sync(dev); pm_runtime_disable(dev); - cdns_pcie_disable_phy(cdns_plat_pcie->pcie); - phy_count = cdns_plat_pcie->pcie->phy_count; + cdns_pcie_disable_phy(pcie); + phy_count = pcie->phy_count; while (phy_count--) - device_link_del(cdns_plat_pcie->pcie->link[phy_count]); + device_link_del(pcie->link[phy_count]); - return 0; + return ret; } static void cdns_plat_pcie_shutdown(struct platform_device *pdev) -- 2.53.0