iwlegacy: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 15:21:18 +0000 (16:21 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 1 Feb 2019 12:28:59 +0000 (14:28 +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: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/intel/iwlegacy/3945-mac.c
drivers/net/wireless/intel/iwlegacy/4965-mac.c
drivers/net/wireless/intel/iwlegacy/common.h
drivers/net/wireless/intel/iwlegacy/debug.c

index 57e3b6cca2341442a8ca23052defbe84f3e3899d..271977f7fbb06e95ac820d26faf29cdc1e1411ac 100644 (file)
@@ -3756,10 +3756,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (err)
                goto out_remove_sysfs;
 
-       err = il_dbgfs_register(il, DRV_NAME);
-       if (err)
-               IL_ERR("failed to create debugfs files. Ignoring error: %d\n",
-                      err);
+       il_dbgfs_register(il, DRV_NAME);
 
        /* Start monitoring the killswitch */
        queue_delayed_work(il->workqueue, &il->_3945.rfkill_poll, 2 * HZ);
index 6b4488a178a7878da2810750fda5c52d95451c45..94222ae464aea8f2f1ecb8dbb0822a453b433a2c 100644 (file)
@@ -4988,10 +4988,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)
        if (err)
                goto out_unbind;
 
-       err = il_dbgfs_register(il, DRV_NAME);
-       if (err)
-               IL_ERR("failed to create debugfs files. Ignoring error: %d\n",
-                      err);
+       il_dbgfs_register(il, DRV_NAME);
 
        err = sysfs_create_group(&il->pci_dev->dev.kobj, &il_attribute_group);
        if (err) {
index dc6a74a0598388d1fcc90519b8c000eaf09c380c..b079c64ca014794dbdf85f7703cfd80a9f65622b 100644 (file)
@@ -2974,13 +2974,11 @@ il_print_hex_dump(struct il_priv *il, int level, const void *p, u32 len)
 #endif /* CONFIG_IWLEGACY_DEBUG */
 
 #ifdef CONFIG_IWLEGACY_DEBUGFS
-int il_dbgfs_register(struct il_priv *il, const char *name);
+void il_dbgfs_register(struct il_priv *il, const char *name);
 void il_dbgfs_unregister(struct il_priv *il);
 #else
-static inline int
-il_dbgfs_register(struct il_priv *il, const char *name)
+static inline void il_dbgfs_register(struct il_priv *il, const char *name)
 {
-       return 0;
 }
 
 static inline void
index d76073def6770034c1c981c7f7fc29fb92caf956..fa211412e0ac4bb95d79cfbdbd1ea89e6a399f3c 100644 (file)
@@ -128,23 +128,12 @@ EXPORT_SYMBOL(il_update_stats);
 
 /* create and remove of files */
 #define DEBUGFS_ADD_FILE(name, parent, mode) do {                      \
-       if (!debugfs_create_file(#name, mode, parent, il,               \
-                        &il_dbgfs_##name##_ops))               \
-               goto err;                                               \
+       debugfs_create_file(#name, mode, parent, il,                    \
+                           &il_dbgfs_##name##_ops);                    \
 } 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;                                               \
+       debugfs_create_bool(#name, 0600, parent, ptr);                  \
 } while (0)
 
 /* file operation */
@@ -1341,27 +1330,18 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout);
  * Create the debugfs files and directories
  *
  */
-int
+void
 il_dbgfs_register(struct il_priv *il, const char *name)
 {
        struct dentry *phyd = il->hw->wiphy->debugfsdir;
        struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
 
        dir_drv = debugfs_create_dir(name, phyd);
-       if (!dir_drv)
-               return -ENOMEM;
-
        il->debugfs_dir = dir_drv;
 
        dir_data = debugfs_create_dir("data", dir_drv);
-       if (!dir_data)
-               goto err;
        dir_rf = debugfs_create_dir("rf", dir_drv);
-       if (!dir_rf)
-               goto err;
        dir_debug = debugfs_create_dir("debug", dir_drv);
-       if (!dir_debug)
-               goto err;
 
        DEBUGFS_ADD_FILE(nvm, dir_data, 0400);
        DEBUGFS_ADD_FILE(sram, dir_data, 0600);
@@ -1399,12 +1379,6 @@ il_dbgfs_register(struct il_priv *il, const char *name)
                DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf,
                                 &il->disable_chain_noise_cal);
        DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, &il->disable_tx_power_cal);
-       return 0;
-
-err:
-       IL_ERR("Can't create the debugfs directory\n");
-       il_dbgfs_unregister(il);
-       return -ENOMEM;
 }
 EXPORT_SYMBOL(il_dbgfs_register);