Skip to contentSkip to conversation

iwlwifi: dvm: no need to check return value of debugfs_create functions

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jan 22, 2019 – Jan 25, 2019 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlwifi: dvm: 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 Johannes Berg <[email protected]>
Cc Emmanuel Grumbach <[email protected]>
Cc Luca Coelho <[email protected]>
Cc Intel Linux Wireless <[email protected]>
Cc Kalle Valo <[email protected]>
---
 drivers/net/wireless/intel/iwlwifi/dvm/agn.h  |  9 ++--
 .../net/wireless/intel/iwlwifi/dvm/debugfs.c  | 44 ++-----------------
 drivers/net/wireless/intel/iwlwifi/dvm/main.c |  5 +--
 3 files changed, 8 insertions(+), 50 deletions(-)
drivers/net/wireless/intel/iwlwifi/dvm/agn.h +3 -6
index 431e13c6ee35..254a5ce52456 100644
@@ -439,13 +439,10 @@ static inline void iwl_dvm_set_pmi(struct iwl_priv *priv, bool state)
 }
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir);
+void iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir);
 #else
-static inline int iwl_dbgfs_register(struct iwl_priv *priv,
-				     struct dentry *dbgfs_dir)
-{
-	return 0;
-}
+static inline void iwl_dbgfs_register(struct iwl_priv *priv,
+				      struct dentry *dbgfs_dir) { }
 #endif /* CONFIG_IWLWIFI_DEBUGFS */
 
 #ifdef CONFIG_IWLWIFI_DEBUG
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c +4 -40

69 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/dvm/main.c +1 -4
index c219bca5cff4..bd912b6a0b38 100644
@@ -1509,13 +1509,10 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
 	if (iwlagn_mac_setup_register(priv, &fw->ucode_capa))
 		goto out_destroy_workqueue;
 
-	if (iwl_dbgfs_register(priv, dbgfs_dir))
-		goto out_mac80211_unregister;
+	iwl_dbgfs_register(priv, dbgfs_dir);
 
 	return op_mode;
 
-out_mac80211_unregister:
-	iwlagn_mac_unregister(priv);
 out_destroy_workqueue:
 	iwl_tt_exit(priv);
 	iwl_cancel_deferred_work(priv);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 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
Cc Johannes Berg <[email protected]>
Cc Emmanuel Grumbach <[email protected]>
Cc Luca Coelho <[email protected]>
Cc Intel Linux Wireless <[email protected]>
Cc Kalle Valo <[email protected]>

---

Thanks, Greg! I applied this in our internal tree and it will reach upstream following our normal upstreaming process.

--
Cheers,
Luca.