All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: netdev@vger.kernel.org,
	Michael Hennerich <michael.hennerich@analog.com>,
	Alexander Aring <alex.aring@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Harry Morris <h.morris@cascoda.com>,
	linux-wpan@vger.kernel.org
Subject: Re: [PATCH 17/17] ieee802154: no need to check return value of debugfs_create functions
Date: Tue, 6 Aug 2019 21:48:54 +0200	[thread overview]
Message-ID: <20190806194854.GA12401@kroah.com> (raw)
In-Reply-To: <a16654ca-078a-8ce4-91a5-055a3ad6e838@datenfreihafen.org>

On Tue, Aug 06, 2019 at 09:22:43PM +0200, Stefan Schmidt wrote:
> Hello.
> 
> On 06.08.19 18:11, Greg Kroah-Hartman wrote:
> > When calling debugfs functions, there is no need to ever check the
> > return value.  The function can work or not, but the code logic should
> > never do something different based on this.
> > 
> > Cc: Michael Hennerich <michael.hennerich@analog.com>
> > Cc: Alexander Aring <alex.aring@gmail.com>
> > Cc: Stefan Schmidt <stefan@datenfreihafen.org>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: Harry Morris <h.morris@cascoda.com>
> > Cc: linux-wpan@vger.kernel.org
> > Cc: netdev@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/net/ieee802154/adf7242.c   | 12 +++---------
> >  drivers/net/ieee802154/at86rf230.c | 20 +++++---------------
> >  drivers/net/ieee802154/ca8210.c    |  9 +--------
> >  3 files changed, 9 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> > index c9392d70e639..7b95add2235a 100644
> > --- a/drivers/net/ieee802154/adf7242.c
> > +++ b/drivers/net/ieee802154/adf7242.c
> > @@ -1158,7 +1158,7 @@ static int adf7242_stats_show(struct seq_file *file, void *offset)
> >  	return 0;
> >  }
> >  
> > -static int adf7242_debugfs_init(struct adf7242_local *lp)
> > +static void adf7242_debugfs_init(struct adf7242_local *lp)
> >  {
> >  	char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "adf7242-";
> >  	struct dentry *stats;
> 
> A quick look over the code indicates that the stats variable can go as
> well now as it is only used in the now removed code.

Odd 0-day never gave me a build warning for it, sorry about that.

> 
> > @@ -1166,15 +1166,9 @@ static int adf7242_debugfs_init(struct adf7242_local *lp)
> >  	strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN);
> >  
> >  	lp->debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL);
> > -	if (IS_ERR_OR_NULL(lp->debugfs_root))
> > -		return PTR_ERR_OR_ZERO(lp->debugfs_root);
> >  
> > -	stats = debugfs_create_devm_seqfile(&lp->spi->dev, "status",
> > -					    lp->debugfs_root,
> > -					    adf7242_stats_show);
> > -	return PTR_ERR_OR_ZERO(stats);
> > -
> > -	return 0;
> > +	debugfs_create_devm_seqfile(&lp->spi->dev, "status", lp->debugfs_root,
> > +				    adf7242_stats_show);
> >  }
> >  
> >  static const s32 adf7242_powers[] = {
> > diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
> > index 595cf7e2a651..7d67f41387f5 100644
> > --- a/drivers/net/ieee802154/at86rf230.c
> > +++ b/drivers/net/ieee802154/at86rf230.c
> > @@ -1626,24 +1626,16 @@ static int at86rf230_stats_show(struct seq_file *file, void *offset)
> >  }
> >  DEFINE_SHOW_ATTRIBUTE(at86rf230_stats);
> >  
> > -static int at86rf230_debugfs_init(struct at86rf230_local *lp)
> > +static void at86rf230_debugfs_init(struct at86rf230_local *lp)
> >  {
> >  	char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "at86rf230-";
> > -	struct dentry *stats;
> >  
> >  	strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN);
> >  
> >  	at86rf230_debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL);
> > -	if (!at86rf230_debugfs_root)
> > -		return -ENOMEM;
> > -
> > -	stats = debugfs_create_file("trac_stats", 0444,
> > -				    at86rf230_debugfs_root, lp,
> > -				    &at86rf230_stats_fops);
> > -	if (!stats)
> > -		return -ENOMEM;
> >  
> > -	return 0;
> > +	debugfs_create_file("trac_stats", 0444, at86rf230_debugfs_root, lp,
> > +			    &at86rf230_stats_fops);
> >  }
> >  
> >  static void at86rf230_debugfs_remove(void)
> > @@ -1651,7 +1643,7 @@ static void at86rf230_debugfs_remove(void)
> >  	debugfs_remove_recursive(at86rf230_debugfs_root);
> >  }
> >  #else
> > -static int at86rf230_debugfs_init(struct at86rf230_local *lp) { return 0; }
> > +static void at86rf230_debugfs_init(struct at86rf230_local *lp) { }
> >  static void at86rf230_debugfs_remove(void) { }
> >  #endif
> >  
> > @@ -1751,9 +1743,7 @@ static int at86rf230_probe(struct spi_device *spi)
> >  	/* going into sleep by default */
> >  	at86rf230_sleep(lp);
> >  
> > -	rc = at86rf230_debugfs_init(lp);
> > -	if (rc)
> > -		goto free_dev;
> > +	at86rf230_debugfs_init(lp);
> >  
> >  	rc = ieee802154_register_hw(lp->hw);
> >  	if (rc)
> > diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> > index b188fce3f641..11402dc347db 100644
> > --- a/drivers/net/ieee802154/ca8210.c
> > +++ b/drivers/net/ieee802154/ca8210.c
> > @@ -3019,14 +3019,7 @@ static int ca8210_test_interface_init(struct ca8210_priv *priv)
> >  		priv,
> >  		&test_int_fops
> >  	);
> > -	if (IS_ERR(test->ca8210_dfs_spi_int)) {
> > -		dev_err(
> > -			&priv->spi->dev,
> > -			"Error %ld when creating debugfs node\n",
> > -			PTR_ERR(test->ca8210_dfs_spi_int)
> > -		);
> > -		return PTR_ERR(test->ca8210_dfs_spi_int);
> > -	}
> > +
> >  	debugfs_create_symlink("ca8210", NULL, node_name);
> >  	init_waitqueue_head(&test->readq);
> >  	return kfifo_alloc(
> > 
> 
> With a fix for the above included you can have my
> 
> 
> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
> 
> for version 2.

I'll fix it up and resend tomorrow, thanks!

greg k-h

  reply	other threads:[~2019-08-06 19:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 16:11 [PATCH 00/17] Networking driver debugfs cleanups Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 01/17] wimax: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 02/17] bonding: no need to print a message if debugfs_create_dir() fails Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 03/17] mlx5: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-08-06 19:41   ` Saeed Mahameed
2019-08-06 19:47     ` gregkh
2019-08-06 20:37   ` Saeed Mahameed
2019-08-06 16:11 ` [PATCH 04/17] xgbe: " Greg Kroah-Hartman
2019-08-06 16:28   ` Lendacky, Thomas
2019-08-06 16:11 ` [PATCH 05/17] bnxt: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 06/17] cxgb4: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 07/17] hns3: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 08/17] nfp: " Greg Kroah-Hartman
2019-08-06 16:50   ` Jakub Kicinski
2019-08-06 17:00     ` Greg Kroah-Hartman
2019-08-06 17:30       ` Jakub Kicinski
2019-08-06 16:11 ` [PATCH 09/17] stmmac: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 10/17] dpaa2: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 11/17] qca: " Greg Kroah-Hartman
2019-08-08  6:30   ` Michael Heimpold
2019-08-06 16:11 ` [PATCH 12/17] skge: " Greg Kroah-Hartman
2019-08-06 17:44   ` Stephen Hemminger
2019-08-06 16:11 ` [PATCH 13/17] mvpp2: " Greg Kroah-Hartman
2019-08-06 16:11 ` [Intel-wired-lan] [PATCH 14/17] fm10k: " Greg Kroah-Hartman
2019-08-06 16:11   ` Greg Kroah-Hartman
2019-08-06 16:11 ` [Intel-wired-lan] [PATCH 15/17] i40e: " Greg Kroah-Hartman
2019-08-06 16:11   ` Greg Kroah-Hartman
2019-08-06 16:11 ` [Intel-wired-lan] [PATCH 16/17] ixgbe: " Greg Kroah-Hartman
2019-08-06 16:11   ` Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 17/17] ieee802154: " Greg Kroah-Hartman
2019-08-06 19:22   ` Stefan Schmidt
2019-08-06 19:48     ` Greg Kroah-Hartman [this message]
2019-08-09  1:37 ` [PATCH 00/17] Networking driver debugfs cleanups David Miller
2019-08-09  1:42   ` David Miller
2019-08-09 12:30     ` Greg KH

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=20190806194854.GA12401@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=h.morris@cascoda.com \
    --cc=linux-wpan@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.