iwlwifi: dvm: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 15:21:19 +0000 (16:21 +0100)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 20 Feb 2019 18:47:56 +0000 (20:47 +0200)
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 <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Intel Linux Wireless <linuxwifi@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/dvm/agn.h
drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
drivers/net/wireless/intel/iwlwifi/dvm/main.c

index 431e13c6ee3540a171fe79b3f8a411ba9c842edc..254a5ce5245643af5578ad7700b3fd8e80e01a89 100644 (file)
@@ -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
index e64cdafc562370b08ca082d2ac99c70baa5290f1..d4b19673b06a80c38311005c2084847e69ec415c 100644 (file)
 
 /* create and remove of files */
 #define DEBUGFS_ADD_FILE(name, parent, mode) do {                      \
-       if (!debugfs_create_file(#name, mode, parent, priv,             \
-                                &iwl_dbgfs_##name##_ops))              \
-               goto err;                                               \
-} while (0)
-
-#define DEBUGFS_ADD_BOOL(name, parent, ptr) do {                       \
-       struct dentry *__tmp;                                           \
-       __tmp = debugfs_create_bool(#name, 0600, parent, ptr);          \
-       if (IS_ERR(__tmp) || !__tmp)                                    \
-               goto err;                                               \
-} while (0)
-
-#define DEBUGFS_ADD_X32(name, parent, ptr) do {                                \
-       struct dentry *__tmp;                                           \
-       __tmp = debugfs_create_x32(#name, 0600, parent, ptr);           \
-       if (IS_ERR(__tmp) || !__tmp)                                    \
-               goto err;                                               \
-} while (0)
-
-#define DEBUGFS_ADD_U32(name, parent, ptr, mode) do {                  \
-       struct dentry *__tmp;                                           \
-       __tmp = debugfs_create_u32(#name, mode,                         \
-                                  parent, ptr);                        \
-       if (IS_ERR(__tmp) || !__tmp)                                    \
-               goto err;                                               \
+       debugfs_create_file(#name, mode, parent, priv,                  \
+                           &iwl_dbgfs_##name##_ops);                   \
 } while (0)
 
 /* file operation */
@@ -2348,21 +2325,15 @@ DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled);
  * Create the debugfs files and directories
  *
  */
-int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
+void iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
 {
        struct dentry *dir_data, *dir_rf, *dir_debug;
 
        priv->debugfs_dir = dbgfs_dir;
 
        dir_data = debugfs_create_dir("data", dbgfs_dir);
-       if (!dir_data)
-               goto err;
        dir_rf = debugfs_create_dir("rf", dbgfs_dir);
-       if (!dir_rf)
-               goto err;
        dir_debug = debugfs_create_dir("debug", dbgfs_dir);
-       if (!dir_debug)
-               goto err;
 
        DEBUGFS_ADD_FILE(nvm, dir_data, 0400);
        DEBUGFS_ADD_FILE(sram, dir_data, 0600);
@@ -2422,13 +2393,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, struct dentry *dbgfs_dir)
 
                snprintf(buf, 100, "../../%pd2", dev_dir);
 
-               if (!debugfs_create_symlink("iwlwifi", mac80211_dir, buf))
-                       goto err;
+               debugfs_create_symlink("iwlwifi", mac80211_dir, buf);
        }
-
-       return 0;
-
-err:
-       IWL_ERR(priv, "failed to create the dvm debugfs entries\n");
-       return -ENOMEM;
 }
index 114f0ab022a7c8be01f28b7da543c89ede7c848a..7c68a86ed9e150c2ec2e0de62a2b79cc147e4218 100644 (file)
@@ -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);