Skip to contentSkip to conversation

realtek: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 3 participants 4 messages Jan 22, 2019 – Feb 1, 2019 Realtek wireless driver (rtlwifi family)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 realtek: 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/realtek/rtlwifi/debug.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +3 -11
index d70385be9976..8186650efc56 100644
@@ -463,12 +463,9 @@ static const struct file_operations file_ops_common_write = {
 #define RTL_DEBUGFS_ADD_CORE(name, mode, fopname)			   \
 	do {								   \
 		rtl_debug_priv_ ##name.rtlpriv = rtlpriv;		   \
-		if (!debugfs_create_file(#name, mode,			   \
-					 parent, &rtl_debug_priv_ ##name,  \
-					 &file_ops_ ##fopname))		   \
-			pr_err("Unable to initialize debugfs:%s/%s\n",	   \
-			       rtlpriv->dbg.debugfs_name,		   \
-			       #name);					   \
+		debugfs_create_file(#name, mode, parent,		   \
+				    &rtl_debug_priv_ ##name,		   \
+				    &file_ops_ ##fopname);		   \
 	} while (0)
 
 #define RTL_DEBUGFS_ADD(name)						   \
@@ -486,11 +483,6 @@ void rtl_debug_add_one(struct ieee80211_hw *hw)
 
 	rtlpriv->dbg.debugfs_dir =
 		debugfs_create_dir(rtlpriv->dbg.debugfs_name, debugfs_topdir);
-	if (!rtlpriv->dbg.debugfs_dir) {
-		pr_err("Unable to init debugfs:/%s/%s\n", rtlpriv->cfg->name,
-		       rtlpriv->dbg.debugfs_name);
-		return;
-	}
 
 	parent = rtlpriv->dbg.debugfs_dir;
 
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 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.

Greg,

Please change the subject to read "rtlwifi: ...". Otherwise the patch is correct.

Thanks,

Larry

#2 lore raw
Quoted 5 lines · Larry Finger
Quoted 4 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.

Quoted 8 lines
Quoted 4 lines

Greg,

Please change the subject to read "rtlwifi: ...". Otherwise the patch is correct.

I can fix that during commit.

Signature · 1 line
Kalle Valo
#3 lore raw

Re: [PATCH] rtlwifi: 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.

3059785bb76e rtlwifi: no need to check return value of debugfs_create functions

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

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