From: Hans Zhang <18255117159@163.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: bhelgaas@google.com, jonathanh@nvidia.com, kw@linux.com,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linux-tegra@vger.kernel.org, lpieralisi@kernel.org,
manivannan.sadhasivam@linaro.org, robh@kernel.org,
thierry.reding@gmail.com
Subject: Re: [PATCH] pci: tegra194: Fix debugfs cleanup for !CONFIG_PCIEASPM
Date: Sun, 6 Apr 2025 00:41:31 +0800 [thread overview]
Message-ID: <c696c21e-97c6-4bfa-bdb4-d519416f5c99@163.com> (raw)
In-Reply-To: <727b55b6-ccba-4498-be95-027a9f67dfa9@wanadoo.fr>
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
next prev parent reply other threads:[~2025-04-05 16:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-05 14:54 [PATCH] pci: tegra194: Fix debugfs cleanup for !CONFIG_PCIEASPM Hans Zhang
2025-04-05 15:28 ` Bjorn Helgaas
2025-04-05 15:49 ` Hans Zhang
2025-04-05 16:17 ` Christophe JAILLET
2025-04-05 16:35 ` Hans Zhang
2025-04-05 16:47 ` Hans Zhang
2025-04-05 17:04 ` Christophe JAILLET
2025-04-05 17:10 ` Hans Zhang
2025-04-05 16:14 ` Christophe JAILLET
2025-04-05 16:41 ` Hans Zhang [this message]
2025-04-06 0:48 ` kernel test robot
2025-04-06 2:10 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c696c21e-97c6-4bfa-bdb4-d519416f5c99@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=jonathanh@nvidia.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox