From 05513c1234d4ab7eafd13eb985f98447c0a421e5 Mon Sep 17 00:00:00 2001 From: Nagarjuna Kristam Date: Tue, 4 Jul 2023 16:34:28 +0530 Subject: [PATCH] NVIDIA: SAUCE: PCI: tegra194: Remove debugfs if link up BugLink: https://bugs.launchpad.net/bugs/2072591 Issue: debugfs entry is available only when link state is up. During shutdown debugfs remove API is called before link state check. This results in duplicate API invocation during shutdown sequence resulting in kernel panic. Fix: Move debugfs removal API post link state check. http://nvbugs/4169798 Signed-off-by: Nagarjuna Kristam Reviewed-by: Prathamesh Shete Reviewed-by: Laxman Dewangan Tested-by: Prathamesh Shete Signed-off-by: Laxman Dewangan Acked-by: Jacob Martin Acked-by: Noah Wager Signed-off-by: Noah Wager --- drivers/pci/controller/dwc/pcie-tegra194.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index e8bb45ddbfec..a94d57c93475 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -3099,7 +3099,6 @@ static void tegra_pcie_dw_shutdown(struct platform_device *pdev) struct tegra_pcie_dw *pcie = platform_get_drvdata(pdev); if (pcie->of_data->mode == DW_PCIE_RC_TYPE) { - debugfs_remove_recursive(pcie->debugfs); disable_irq(pcie->prsnt_irq); disable_irq(pcie->pci.pp.irq); if (IS_ENABLED(CONFIG_PCI_MSI)) @@ -3108,6 +3107,8 @@ static void tegra_pcie_dw_shutdown(struct platform_device *pdev) return; if (!pm_runtime_enabled(pcie->dev)) return; + + debugfs_remove_recursive(pcie->debugfs); tegra_pcie_dw_pme_turnoff(pcie); tegra_pcie_unconfig_controller(pcie); pm_runtime_put_sync(pcie->dev);