Skip to contentSkip to conversation

quantenna: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 3 participants 3 messages Jan 22, 2019 – Feb 1, 2019 Quantenna qtnfmac wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quantenna: no need to check return value of debugfs_create functions

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 Igor Mitsyanko <[email protected]>
Cc Avinash Patil <[email protected]>
Cc Sergey Matyukevich <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/quantenna/qtnfmac/debug.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/wireless/quantenna/qtnfmac/debug.c +1 -13
index 9f826b9ef5d9..10156780ea37 100644
@@ -16,17 +16,9 @@
 
 #include "debug.h"
 
-#undef pr_fmt
-#define pr_fmt(fmt)	"qtnfmac dbg: %s: " fmt, __func__
-
 void qtnf_debugfs_init(struct qtnf_bus *bus, const char *name)
 {
 	bus->dbg_dir = debugfs_create_dir(name, NULL);
-
-	if (IS_ERR_OR_NULL(bus->dbg_dir)) {
-		pr_warn("failed to create debugfs root dir\n");
-		bus->dbg_dir = NULL;
-	}
 }
 
 void qtnf_debugfs_remove(struct qtnf_bus *bus)
@@ -38,9 +30,5 @@ void qtnf_debugfs_remove(struct qtnf_bus *bus)
 void qtnf_debugfs_add_entry(struct qtnf_bus *bus, const char *name,
 			    int (*fn)(struct seq_file *seq, void *data))
 {
-	struct dentry *entry;
-
-	entry = debugfs_create_devm_seqfile(bus->dev, name, bus->dbg_dir, fn);
-	if (IS_ERR_OR_NULL(entry))
-		pr_warn("failed to add entry (%s)\n", name);
+	debugfs_create_devm_seqfile(bus->dev, name, bus->dbg_dir, fn);
 }
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines

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 Igor Mitsyanko <[email protected]>
Cc Avinash Patil <[email protected]>
Cc Sergey Matyukevich <[email protected]>
Cc Kalle Valo <[email protected]>
Quoted 3 lines
---
 drivers/net/wireless/quantenna/qtnfmac/debug.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Regards,
Sergey

#2 lore raw

Re: [PATCH] qtnfmac: no need to check return value of debugfs_create functions

In reply to Greg Kroah-Hartman
Quoted 11 lines · Greg Kroah-Hartman

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.

Patch applied to wireless-drivers-next.git, thanks.

b089e6944af3 qtnfmac: no need to check return value of debugfs_create functions

Signature · 3 lines
https://patchwork.kernel.org/patch/10775741/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches