Blame SOURCES/0056-netdrv-bnxt-no-need-to-check-return-value-of-debugfs.patch

f95c89
From 2ebefa82c1a4132e47d8e9ebaa8c1ba1647c3a7f Mon Sep 17 00:00:00 2001
f95c89
From: Jonathan Toppins <jtoppins@redhat.com>
f95c89
Date: Wed, 2 Oct 2019 18:23:11 -0400
f95c89
Subject: [PATCH 56/96] [netdrv] bnxt: no need to check return value of
f95c89
 debugfs_create functions
f95c89
f95c89
Message-id: <85557a81f2bb78d291f389dfdd9b0175b2d8f3e2.1570027456.git.jtoppins@redhat.com>
f95c89
Patchwork-id: 276475
f95c89
O-Subject: [RHEL-8.2 PATCH 49/78] bnxt: no need to check return value of debugfs_create functions
f95c89
Bugzilla: 1724766
f95c89
RH-Acked-by: John Linville <linville@redhat.com>
f95c89
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
f95c89
f95c89
When calling debugfs functions, there is no need to ever check the
f95c89
return value.  The function can work or not, but the code logic should
f95c89
never do something different based on this.
f95c89
f95c89
This cleans up a lot of unneeded code and logic around the debugfs
f95c89
files, making all of this much simpler and easier to understand.
f95c89
f95c89
Cc: Michael Chan <michael.chan@broadcom.com>
f95c89
Cc: "David S. Miller" <davem@davemloft.net>
f95c89
Cc: netdev@vger.kernel.org
f95c89
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f95c89
Signed-off-by: David S. Miller <davem@davemloft.net>
f95c89
(cherry picked from commit 3a131e85043cf538d5e70c0f23f9d69a4dd642b9)
f95c89
Bugzilla: 1724766
f95c89
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23809532
f95c89
Tested: build, boot, basic ping
f95c89
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
f95c89
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
f95c89
---
f95c89
 drivers/net/ethernet/broadcom/bnxt/bnxt.h         |  1 -
f95c89
 drivers/net/ethernet/broadcom/bnxt/bnxt_debugfs.c | 39 +++++++----------------
f95c89
 2 files changed, 11 insertions(+), 29 deletions(-)
f95c89
f95c89
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.h
f95c89
===================================================================
f95c89
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.h	2020-02-06 16:23:17.543496327 +0100
f95c89
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.h	2020-02-06 16:23:17.788494078 +0100
f95c89
@@ -1724,7 +1724,6 @@
f95c89
 	u8			switch_id[8];
f95c89
 	struct bnxt_tc_info	*tc_info;
f95c89
 	struct dentry		*debugfs_pdev;
f95c89
-	struct dentry		*debugfs_dim;
f95c89
 	struct device		*hwmon_dev;
f95c89
 };
f95c89
 
f95c89
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_debugfs.c
f95c89
===================================================================
f95c89
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_debugfs.c	2020-02-06 16:22:54.954703674 +0100
f95c89
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_debugfs.c	2020-02-06 16:23:17.788494078 +0100
f95c89
@@ -61,45 +61,30 @@
f95c89
 	.read = debugfs_dim_read,
f95c89
 };
f95c89
 
f95c89
-static struct dentry *debugfs_dim_ring_init(struct net_dim *dim, int ring_idx,
f95c89
-					    struct dentry *dd)
f95c89
+static void debugfs_dim_ring_init(struct net_dim *dim, int ring_idx,
f95c89
+				  struct dentry *dd)
f95c89
 {
f95c89
 	static char qname[16];
f95c89
 
f95c89
 	snprintf(qname, 10, "%d", ring_idx);
f95c89
-	return debugfs_create_file(qname, 0600, dd,
f95c89
-				   dim, &debugfs_dim_fops);
f95c89
+	debugfs_create_file(qname, 0600, dd, dim, &debugfs_dim_fops);
f95c89
 }
f95c89
 
f95c89
 void bnxt_debug_dev_init(struct bnxt *bp)
f95c89
 {
f95c89
 	const char *pname = pci_name(bp->pdev);
f95c89
-	struct dentry *pdevf;
f95c89
+	struct dentry *dir;
f95c89
 	int i;
f95c89
 
f95c89
 	bp->debugfs_pdev = debugfs_create_dir(pname, bnxt_debug_mnt);
f95c89
-	if (bp->debugfs_pdev) {
f95c89
-		pdevf = debugfs_create_dir("dim", bp->debugfs_pdev);
f95c89
-		if (!pdevf) {
f95c89
-			pr_err("failed to create debugfs entry %s/dim\n",
f95c89
-			       pname);
f95c89
-			return;
f95c89
-		}
f95c89
-		bp->debugfs_dim = pdevf;
f95c89
-		/* create files for each rx ring */
f95c89
-		for (i = 0; i < bp->cp_nr_rings; i++) {
f95c89
-			struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring;
f95c89
-
f95c89
-			if (cpr && bp->bnapi[i]->rx_ring) {
f95c89
-				pdevf = debugfs_dim_ring_init(&cpr->dim, i,
f95c89
-							      bp->debugfs_dim);
f95c89
-				if (!pdevf)
f95c89
-					pr_err("failed to create debugfs entry %s/dim/%d\n",
f95c89
-					       pname, i);
f95c89
-			}
f95c89
-		}
f95c89
-	} else {
f95c89
-		pr_err("failed to create debugfs entry %s\n", pname);
f95c89
+	dir = debugfs_create_dir("dim", bp->debugfs_pdev);
f95c89
+
f95c89
+	/* create files for each rx ring */
f95c89
+	for (i = 0; i < bp->cp_nr_rings; i++) {
f95c89
+		struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring;
f95c89
+
f95c89
+		if (cpr && bp->bnapi[i]->rx_ring)
f95c89
+			debugfs_dim_ring_init(&cpr->dim, i, dir);
f95c89
 	}
f95c89
 }
f95c89
 
f95c89
@@ -114,8 +99,6 @@
f95c89
 void bnxt_debug_init(void)
f95c89
 {
f95c89
 	bnxt_debug_mnt = debugfs_create_dir("bnxt_en", NULL);
f95c89
-	if (!bnxt_debug_mnt)
f95c89
-		pr_err("failed to init bnxt_en debugfs\n");
f95c89
 }
f95c89
 
f95c89
 void bnxt_debug_exit(void)