Message ID | 20250225171239.19574-2-manivannan.sadhasivam@linaro.org (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Krzysztof WilczyĆski |
Headers | show |
Series | PCI: dwc-debugfs: Couple of fixes | expand |
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); }
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@linaro.org> --- drivers/pci/controller/dwc/pcie-designware-debugfs.c | 3 +++ 1 file changed, 3 insertions(+)