netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: netdev@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ioana Radulescu <ruxandra.radulescu@nxp.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH v3 10/17] dpaa2: no need to check return value of debugfs_create functions
Date: Sat, 10 Aug 2019 12:17:25 +0200	[thread overview]
Message-ID: <20190810101732.26612-11-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20190810101732.26612-1-gregkh@linuxfoundation.org>

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.

Because we don't care about the individual files, we can remove the
stored dentry for the files, as they are not needed to be kept track of
at all.

Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 .../freescale/dpaa2/dpaa2-eth-debugfs.c       | 54 +++----------------
 .../freescale/dpaa2/dpaa2-eth-debugfs.h       |  3 --
 2 files changed, 7 insertions(+), 50 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
index a027f4a9d0cc..a9afe46b837f 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.c
@@ -164,70 +164,30 @@ static const struct file_operations dpaa2_dbg_ch_ops = {
 
 void dpaa2_dbg_add(struct dpaa2_eth_priv *priv)
 {
-	if (!dpaa2_dbg_root)
-		return;
+	struct dentry *dir;
 
 	/* Create a directory for the interface */
-	priv->dbg.dir = debugfs_create_dir(priv->net_dev->name,
-					   dpaa2_dbg_root);
-	if (!priv->dbg.dir) {
-		netdev_err(priv->net_dev, "debugfs_create_dir() failed\n");
-		return;
-	}
+	dir = debugfs_create_dir(priv->net_dev->name, dpaa2_dbg_root);
+	priv->dbg.dir = dir;
 
 	/* per-cpu stats file */
-	priv->dbg.cpu_stats = debugfs_create_file("cpu_stats", 0444,
-						  priv->dbg.dir, priv,
-						  &dpaa2_dbg_cpu_ops);
-	if (!priv->dbg.cpu_stats) {
-		netdev_err(priv->net_dev, "debugfs_create_file() failed\n");
-		goto err_cpu_stats;
-	}
+	debugfs_create_file("cpu_stats", 0444, dir, priv, &dpaa2_dbg_cpu_ops);
 
 	/* per-fq stats file */
-	priv->dbg.fq_stats = debugfs_create_file("fq_stats", 0444,
-						 priv->dbg.dir, priv,
-						 &dpaa2_dbg_fq_ops);
-	if (!priv->dbg.fq_stats) {
-		netdev_err(priv->net_dev, "debugfs_create_file() failed\n");
-		goto err_fq_stats;
-	}
+	debugfs_create_file("fq_stats", 0444, dir, priv, &dpaa2_dbg_fq_ops);
 
 	/* per-fq stats file */
-	priv->dbg.ch_stats = debugfs_create_file("ch_stats", 0444,
-						 priv->dbg.dir, priv,
-						 &dpaa2_dbg_ch_ops);
-	if (!priv->dbg.fq_stats) {
-		netdev_err(priv->net_dev, "debugfs_create_file() failed\n");
-		goto err_ch_stats;
-	}
-
-	return;
-
-err_ch_stats:
-	debugfs_remove(priv->dbg.fq_stats);
-err_fq_stats:
-	debugfs_remove(priv->dbg.cpu_stats);
-err_cpu_stats:
-	debugfs_remove(priv->dbg.dir);
+	debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_ops);
 }
 
 void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv)
 {
-	debugfs_remove(priv->dbg.fq_stats);
-	debugfs_remove(priv->dbg.ch_stats);
-	debugfs_remove(priv->dbg.cpu_stats);
-	debugfs_remove(priv->dbg.dir);
+	debugfs_remove_recursive(priv->dbg.dir);
 }
 
 void dpaa2_eth_dbg_init(void)
 {
 	dpaa2_dbg_root = debugfs_create_dir(DPAA2_ETH_DBG_ROOT, NULL);
-	if (!dpaa2_dbg_root) {
-		pr_err("DPAA2-ETH: debugfs create failed\n");
-		return;
-	}
-
 	pr_debug("DPAA2-ETH: debugfs created\n");
 }
 
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.h
index 4f63de997a26..15598b28f03b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth-debugfs.h
@@ -11,9 +11,6 @@ struct dpaa2_eth_priv;
 
 struct dpaa2_debugfs {
 	struct dentry *dir;
-	struct dentry *fq_stats;
-	struct dentry *ch_stats;
-	struct dentry *cpu_stats;
 };
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.22.0


  parent reply	other threads:[~2019-08-10 10:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-10 10:17 [PATCH v3 00/17] Networking driver debugfs cleanups Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 01/17] wimax: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 02/17] bonding: no need to print a message if debugfs_create_dir() fails Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 03/17] mlx5: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 04/17] xgbe: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 05/17] bnxt: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 06/17] cxgb4: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 07/17] hns3: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 08/17] nfp: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 09/17] stmmac: " Greg Kroah-Hartman
2019-08-10 10:17 ` Greg Kroah-Hartman [this message]
2019-08-10 10:17 ` [PATCH v3 11/17] qca: " Greg Kroah-Hartman
2019-08-13  9:21   ` Stefan Wahren
2019-08-10 10:17 ` [PATCH v3 12/17] skge: " Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 13/17] mvpp2: " Greg Kroah-Hartman
2019-08-12 17:55   ` Nick Desaulniers
2019-08-12 19:01     ` Greg Kroah-Hartman
2019-08-12 19:44       ` Nick Desaulniers
2019-08-12 19:51         ` Greg Kroah-Hartman
2019-08-10 10:17 ` [PATCH v3 14/17] fm10k: " Greg Kroah-Hartman
2019-08-12 15:46   ` Jeff Kirsher
2019-08-10 10:17 ` [PATCH v3 15/17] i40e: " Greg Kroah-Hartman
2019-08-12 15:48   ` Jeff Kirsher
2019-08-10 10:17 ` [PATCH v3 16/17] ixgbe: " Greg Kroah-Hartman
2019-08-12 15:49   ` Jeff Kirsher
2019-08-10 10:17 ` [PATCH v3 17/17] ieee802154: " Greg Kroah-Hartman
2019-08-10 22:26 ` [PATCH v3 00/17] Networking driver debugfs cleanups David Miller

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=20190810101732.26612-11-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ruxandra.radulescu@nxp.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).