netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Zhengchao Shao <shaozhengchao@huawei.com>,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, andy@greyhouse.net,
	weiyongjun1@huawei.com, yuehaibing@huawei.com
Subject: Re: [PATCH net-next 3/5] bonding: remove unnecessary NULL check in debugfs function
Date: Thu, 10 Aug 2023 11:08:13 +0800	[thread overview]
Message-ID: <ZNRUnUV92x1s3Aj0@Laptop-X1> (raw)
In-Reply-To: <CAAoacN=Lmh0h_9wQvAe_NRDw_SV22NYA3CN_-uvkOoPs6kQmxg@mail.gmail.com>

On Wed, Aug 09, 2023 at 09:13:31AM -0700, Jay Vosburgh wrote:
> On 8/9/23, Zhengchao Shao <shaozhengchao@huawei.com> wrote:
> > Because debugfs_create_dir returns ERR_PTR, so bonding_debug_root will
> > never be NULL. Remove unnecessary NULL check for bonding_debug_root in
> > debugfs function.
> 
> So after this change it will call debugfs_create_dir(), et al, with
> the ERR_PTR value?  Granted, the current behavior is probably not
> right, but I don't see how this makes things better.

I guess Zhengchao means to remove Redundant checks? The later
debugfs_create_dir/debugfs_remove_recursive/debugfs_remove_recursive functions
will check the dentry with IS_ERR(). But I think the commit description need
an update.

Hangbin

> 
> -J
> 
> >
> > Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> > ---
> >  drivers/net/bonding/bond_debugfs.c | 9 ---------
> >  1 file changed, 9 deletions(-)
> >
> > diff --git a/drivers/net/bonding/bond_debugfs.c
> > b/drivers/net/bonding/bond_debugfs.c
> > index e4e7f4ee48e0..4c83f89c0a47 100644
> > --- a/drivers/net/bonding/bond_debugfs.c
> > +++ b/drivers/net/bonding/bond_debugfs.c
> > @@ -49,9 +49,6 @@ DEFINE_SHOW_ATTRIBUTE(bond_debug_rlb_hash);
> >
> >  void bond_debug_register(struct bonding *bond)
> >  {
> > -	if (!bonding_debug_root)
> > -		return;
> > -
> >  	bond->debug_dir =
> >  		debugfs_create_dir(bond->dev->name, bonding_debug_root);
> >
> > @@ -61,9 +58,6 @@ void bond_debug_register(struct bonding *bond)
> >
> >  void bond_debug_unregister(struct bonding *bond)
> >  {
> > -	if (!bonding_debug_root)
> > -		return;
> > -
> >  	debugfs_remove_recursive(bond->debug_dir);
> >  }
> >
> > @@ -71,9 +65,6 @@ void bond_debug_reregister(struct bonding *bond)
> >  {
> >  	struct dentry *d;
> >
> > -	if (!bonding_debug_root)
> > -		return;
> > -
> >  	d = debugfs_rename(bonding_debug_root, bond->debug_dir,
> >  			   bonding_debug_root, bond->dev->name);
> >  	if (!IS_ERR(d)) {
> > --
> > 2.34.1
> >
> >

  reply	other threads:[~2023-08-10  3:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 12:41 [PATCH net-next 0/5] bonding: do some cleanups in bond driver Zhengchao Shao
2023-08-09 12:41 ` [PATCH net-next 1/5] bonding: add modifier to initialization function and exit function Zhengchao Shao
2023-08-13  7:57   ` Leon Romanovsky
2023-08-09 12:41 ` [PATCH net-next 2/5] bonding: remove warning printing in bond_create_debugfs Zhengchao Shao
2023-08-10  2:53   ` Hangbin Liu
2023-08-10  8:06     ` shaozhengchao
2023-08-09 12:41 ` [PATCH net-next 3/5] bonding: remove unnecessary NULL check in debugfs function Zhengchao Shao
2023-08-09 16:13   ` Jay Vosburgh
2023-08-10  3:08     ` Hangbin Liu [this message]
2023-08-10  8:08       ` shaozhengchao
2023-08-09 12:41 ` [PATCH net-next 4/5] bonding: use bond_set_slave_arr to simplify code Zhengchao Shao
2023-08-10  0:17   ` Vadim Fedorenko
2023-08-10  8:10     ` shaozhengchao
2023-08-09 12:41 ` [PATCH net-next 5/5] bonding: remove unnecessary NULL check in bond_destructor Zhengchao Shao
2023-08-13  7:58   ` Leon Romanovsky

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=ZNRUnUV92x1s3Aj0@Laptop-X1 \
    --to=liuhangbin@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=j.vosburgh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shaozhengchao@huawei.com \
    --cc=weiyongjun1@huawei.com \
    --cc=yuehaibing@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).