Skip to contentSkip to conversation

ti: wl18xx: 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 TI wilink wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ti: wl18xx: 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.

---
 drivers/net/wireless/ti/wl18xx/debugfs.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
drivers/net/wireless/ti/wl18xx/debugfs.c +1 -19
index 597e934c4630..5f4ec997ca59 100644
@@ -422,20 +422,10 @@ static const struct file_operations radar_debug_mode_ops = {
 int wl18xx_debugfs_add_files(struct wl1271 *wl,
 			     struct dentry *rootdir)
 {
-	int ret = 0;
-	struct dentry *entry, *stats, *moddir;
+	struct dentry *stats, *moddir;
 
 	moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
-	if (!moddir || IS_ERR(moddir)) {
-		entry = moddir;
-		goto err;
-	}
-
 	stats = debugfs_create_dir("fw_stats", moddir);
-	if (!stats || IS_ERR(stats)) {
-		entry = stats;
-		goto err;
-	}
 
 	DEBUGFS_ADD(clear_fw_stats, stats);
 
@@ -590,12 +580,4 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
 	DEBUGFS_ADD(dynamic_fw_traces, moddir);
 
 	return 0;
-
-err:
-	if (IS_ERR(entry))
-		ret = PTR_ERR(entry);
-	else
-		ret = -ENOMEM;
-
-	return ret;
 }
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 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.

#2 lore raw

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

In reply to Greg Kroah-Hartman
Quoted 9 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.

c922a3a02d2b wl18xx: no need to check return value of debugfs_create functions

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

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