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

From: Krzysztof Wilczyński
Date: Wed Feb 26 2025 - 01:53:57 EST


Hello,

> 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.

Good catch! With that...

Reviewed-by: Krzysztof Wilczyński <kwilczynski@xxxxxxxxxx>

Thank you!

Krzysztof