From: Simon Horman <horms@kernel.org>
To: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Rasesh Mody <rmody@marvell.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
GR-Linux-NIC-Dev@marvell.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] bna: Fix return value check for debugfs create APIs
Date: Thu, 24 Oct 2024 13:13:25 +0100 [thread overview]
Message-ID: <20241024121325.GJ1202098@kernel.org> (raw)
In-Reply-To: <20241023080921.326-2-thunder.leizhen@huawei.com>
On Wed, Oct 23, 2024 at 04:09:20PM +0800, Zhen Lei wrote:
> Fix the incorrect return value check for debugfs_create_dir() and
> debugfs_create_file(), which returns ERR_PTR(-ERROR) instead of NULL
> when it fails.
>
> Commit 4ad23d2368cc ("bna: Remove error checking for
> debugfs_create_dir()") allows the program to continue execution if the
> creation of bnad->port_debugfs_root fails, which causes the atomic count
> bna_debugfs_port_count to be unbalanced. The corresponding error check
> need to be added back.
Hi Zhen Lei,
The documentation for debugfs_create_dir states:
* NOTE: it's expected that most callers should _ignore_ the errors returned
* by this function. Other debugfs functions handle the fact that the "dentry"
* passed to them could be an error and they don't crash in that case.
* Drivers should generally work fine even if debugfs fails to init anyway.
Which makes me wonder why we are checking the return value of
debugfs_create_dir() at all. Can't we just take advantage of
it not mattering, to debugfs functions, if the return value
is an error or not?
> Fixes: 4ad23d2368cc ("bna: Remove error checking for debugfs_create_dir()")
> Fixes: 7afc5dbde091 ("bna: Add debugfs interface.")
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
...
next prev parent reply other threads:[~2024-10-24 12:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 8:09 [PATCH 0/2] bna: Fix return value check for debugfs create APIs Zhen Lei
2024-10-23 8:09 ` [PATCH 1/2] " Zhen Lei
2024-10-24 12:13 ` Simon Horman [this message]
2024-10-24 13:26 ` Leizhen (ThunderTown)
2024-10-24 14:04 ` Andrew Lunn
2024-10-25 3:55 ` Leizhen (ThunderTown)
2024-10-24 15:27 ` Simon Horman
2024-10-25 4:17 ` Leizhen (ThunderTown)
2024-10-25 12:09 ` Simon Horman
2024-10-23 8:09 ` [PATCH 2/2] bna: Remove field bnad_dentry_files[] in struct bnad Zhen Lei
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=20241024121325.GJ1202098@kernel.org \
--to=horms@kernel.org \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmody@marvell.com \
--cc=skalluru@marvell.com \
--cc=thunder.leizhen@huawei.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;
as well as URLs for NNTP newsgroup(s).