Skip to content

Commit

Permalink
ieee802154: no need to check return value of debugfs_create functions
Browse files Browse the repository at this point in the history
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: Alexander Aring <alex.aring@gmail.com>
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
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Greg Kroah-Hartman authored and David S. Miller committed Aug 10, 2019
1 parent 35dc61e commit 7e174a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
13 changes: 3 additions & 10 deletions drivers/net/ieee802154/adf7242.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,23 +1158,16 @@ 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;

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[] = {
Expand Down
20 changes: 5 additions & 15 deletions drivers/net/ieee802154/at86rf230.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,32 +1626,24 @@ 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)
{
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

Expand Down Expand Up @@ -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)
Expand Down
9 changes: 1 addition & 8 deletions drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 7e174a4

Please sign in to comment.