[PATCH 1/2] PCI: dwc-debugfs: Perform deinit only when the debugfs is initialized

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some endpoint controller drivers like pcie-qcom-ep, pcie-tegra194 call
dw_pcie_ep_cleanup() to cleanup the resources at the start of the PERST#
deassert (due to refclk dependency). By that time, debugfs won't be
registered, leading to NULL pointer dereference:

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Call trace:
dwc_pcie_debugfs_deinit+0x18/0x38 (P)
dw_pcie_ep_cleanup+0x2c/0x50
qcom_pcie_ep_perst_irq_thread+0x278/0x5e8

So perform deinit only when the debugfs is initialized.

Fixes: 24c117c60658 ("PCI: dwc: Add debugfs based Silicon Debug support for DWC")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
---
 drivers/pci/controller/dwc/pcie-designware-debugfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
index dca1e9999113..9ff4d45e80f1 100644
--- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
+++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
@@ -535,6 +535,9 @@ static int dwc_pcie_rasdes_debugfs_init(struct dw_pcie *pci, struct dentry *dir)
 
 void dwc_pcie_debugfs_deinit(struct dw_pcie *pci)
 {
+	if (!pci->debugfs)
+		return;
+
 	dwc_pcie_rasdes_debugfs_deinit(pci);
 	debugfs_remove_recursive(pci->debugfs->debug_dir);
 }
-- 
2.25.1





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux