[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c696c21e-97c6-4bfa-bdb4-d519416f5c99@163.com>
Date: Sun, 6 Apr 2025 00:41:31 +0800
From: Hans Zhang <18255117159@....com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: bhelgaas@...gle.com, jonathanh@...dia.com, kw@...ux.com,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-tegra@...r.kernel.org, lpieralisi@...nel.org,
manivannan.sadhasivam@...aro.org, robh@...nel.org, thierry.reding@...il.com
Subject: Re: [PATCH] pci: tegra194: Fix debugfs cleanup for !CONFIG_PCIEASPM
On 2025/4/6 00:14, Christophe JAILLET wrote:
> Le 05/04/2025 à 16:54, Hans Zhang a écrit :
>> When CONFIG_PCIEASPM is disabled, debugfs entries are not created, but
>> tegra_pcie_dw_remove() and tegra_pcie_dw_shutdown() unconditionally call
>> debugfs_remove_recursive(), leading to potential NULL pointer operations.
>>
>> Introduce deinit_debugfs() to wrap debugfs_remove_recursive(), which is
>> stubbed for !CONFIG_PCIEASPM. Use this function during
>> removal/shutdown to
>> ensure debugfs cleanup only occurs when entries were initialized.
>>
>> This prevents kernel warnings and instability when ASPM support is
>> disabled.
>>
>
> Could you elaborate?
>
>
> debugfs_remove_recursive() ends either to:
>
> static inline void debugfs_remove(struct dentry *dentry)
> { }
> if CONFIG_DEBUG_FS is not set,
>
> or
> to a function which starts with:
> if (IS_ERR_OR_NULL(dentry))
> return;
> if it is set.
>
>
> So what does this new deinit_debugfs() add?
>
>
> Which NULL pointer are you seeing?
> Did you actually manage to trigger it?
>
Hi Christophe,
You're right, and I'm sorry about that.
The following line of code only makes sense if the #if
defined(CONFIG_PCIEASPM) condition holds. Do we need to optimize this?
pcie->debugfs = debugfs_create_dir(name, NULL);
Best regards,
Hans
Powered by blists - more mailing lists