All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: netdev@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mirko Lindner <mlindner@marvell.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 12/17] skge: no need to check return value of debugfs_create functions
Date: Tue,  6 Aug 2019 18:11:23 +0200	[thread overview]
Message-ID: <20190806161128.31232-13-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20190806161128.31232-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.

Cc: Mirko Lindner <mlindner@marvell.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/marvell/skge.c | 39 +++++++----------------------
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
index 06dffee81e02..0a2ec387a482 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -3731,7 +3731,6 @@ static int skge_device_event(struct notifier_block *unused,
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct skge_port *skge;
-	struct dentry *d;
 
 	if (dev->netdev_ops->ndo_open != &skge_up || !skge_debug)
 		goto done;
@@ -3739,33 +3738,20 @@ static int skge_device_event(struct notifier_block *unused,
 	skge = netdev_priv(dev);
 	switch (event) {
 	case NETDEV_CHANGENAME:
-		if (skge->debugfs) {
-			d = debugfs_rename(skge_debug, skge->debugfs,
-					   skge_debug, dev->name);
-			if (d)
-				skge->debugfs = d;
-			else {
-				netdev_info(dev, "rename failed\n");
-				debugfs_remove(skge->debugfs);
-			}
-		}
+		if (skge->debugfs)
+			skge->debugfs = debugfs_rename(skge_debug,
+						       skge->debugfs,
+						       skge_debug, dev->name);
 		break;
 
 	case NETDEV_GOING_DOWN:
-		if (skge->debugfs) {
-			debugfs_remove(skge->debugfs);
-			skge->debugfs = NULL;
-		}
+		debugfs_remove(skge->debugfs);
+		skge->debugfs = NULL;
 		break;
 
 	case NETDEV_UP:
-		d = debugfs_create_file(dev->name, 0444,
-					skge_debug, dev,
-					&skge_debug_fops);
-		if (!d || IS_ERR(d))
-			netdev_info(dev, "debugfs create failed\n");
-		else
-			skge->debugfs = d;
+		skge->debugfs = debugfs_create_file(dev->name, 0444, skge_debug,
+						    dev, &skge_debug_fops);
 		break;
 	}
 
@@ -3780,15 +3766,8 @@ static struct notifier_block skge_notifier = {
 
 static __init void skge_debug_init(void)
 {
-	struct dentry *ent;
-
-	ent = debugfs_create_dir("skge", NULL);
-	if (!ent || IS_ERR(ent)) {
-		pr_info("debugfs create directory failed\n");
-		return;
-	}
+	skge_debug = debugfs_create_dir("skge", NULL);
 
-	skge_debug = ent;
 	register_netdevice_notifier(&skge_notifier);
 }
 
-- 
2.22.0


  parent reply	other threads:[~2019-08-06 16:11 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 ` Greg Kroah-Hartman [this message]
2019-08-06 17:44   ` [PATCH 12/17] skge: " Stephen Hemminger
2019-08-06 16:11 ` [PATCH 13/17] mvpp2: " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 14/17] fm10k: " Greg Kroah-Hartman
2019-08-06 16:11   ` [Intel-wired-lan] " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 15/17] i40e: " Greg Kroah-Hartman
2019-08-06 16:11   ` [Intel-wired-lan] " Greg Kroah-Hartman
2019-08-06 16:11 ` [PATCH 16/17] ixgbe: " Greg Kroah-Hartman
2019-08-06 16:11   ` [Intel-wired-lan] " 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
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=20190806161128.31232-13-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=mlindner@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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.