wlcore: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 15:21:24 +0000 (16:21 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 1 Feb 2019 12:29:50 +0000 (14:29 +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: Kalle Valo <kvalo@codeaurora.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ti/wlcore/debugfs.c
drivers/net/wireless/ti/wlcore/debugfs.h

index aeb74e7..68acd90 100644 (file)
@@ -1301,11 +1301,10 @@ static const struct file_operations fw_logger_ops = {
        .llseek = default_llseek,
 };
 
-static int wl1271_debugfs_add_files(struct wl1271 *wl,
-                                   struct dentry *rootdir)
+static void wl1271_debugfs_add_files(struct wl1271 *wl,
+                                    struct dentry *rootdir)
 {
-       int ret = 0;
-       struct dentry *entry, *streaming;
+       struct dentry *streaming;
 
        DEBUGFS_ADD(tx_queue_len, rootdir);
        DEBUGFS_ADD(retry_count, rootdir);
@@ -1330,23 +1329,11 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
        DEBUGFS_ADD(fw_logger, rootdir);
 
        streaming = debugfs_create_dir("rx_streaming", rootdir);
-       if (!streaming || IS_ERR(streaming))
-               goto err;
 
        DEBUGFS_ADD_PREFIX(rx_streaming, interval, streaming);
        DEBUGFS_ADD_PREFIX(rx_streaming, always, streaming);
 
        DEBUGFS_ADD_PREFIX(dev, mem, rootdir);
-
-       return 0;
-
-err:
-       if (IS_ERR(entry))
-               ret = PTR_ERR(entry);
-       else
-               ret = -ENOMEM;
-
-       return ret;
 }
 
 void wl1271_debugfs_reset(struct wl1271 *wl)
@@ -1367,11 +1354,6 @@ int wl1271_debugfs_init(struct wl1271 *wl)
        rootdir = debugfs_create_dir(KBUILD_MODNAME,
                                     wl->hw->wiphy->debugfsdir);
 
-       if (IS_ERR(rootdir)) {
-               ret = PTR_ERR(rootdir);
-               goto out;
-       }
-
        wl->stats.fw_stats = kzalloc(wl->stats.fw_stats_len, GFP_KERNEL);
        if (!wl->stats.fw_stats) {
                ret = -ENOMEM;
@@ -1380,9 +1362,7 @@ int wl1271_debugfs_init(struct wl1271 *wl)
 
        wl->stats.fw_stats_update = jiffies;
 
-       ret = wl1271_debugfs_add_files(wl, rootdir);
-       if (ret < 0)
-               goto out_exit;
+       wl1271_debugfs_add_files(wl, rootdir);
 
        ret = wlcore_debugfs_init(wl, rootdir);
        if (ret < 0)
index bf14676..a4952c4 100644 (file)
@@ -53,19 +53,15 @@ static const struct file_operations name## _ops = {                 \
 
 #define DEBUGFS_ADD(name, parent)                                      \
        do {                                                            \
-               entry = debugfs_create_file(#name, 0400, parent,        \
-                                           wl, &name## _ops);          \
-               if (!entry || IS_ERR(entry))                            \
-                       goto err;                                       \
+               debugfs_create_file(#name, 0400, parent,                \
+                                   wl, &name## _ops);                  \
        } while (0)
 
 
 #define DEBUGFS_ADD_PREFIX(prefix, name, parent)                       \
        do {                                                            \
-               entry = debugfs_create_file(#name, 0400, parent,        \
+               debugfs_create_file(#name, 0400, parent,                \
                                    wl, &prefix## _## name## _ops);     \
-               if (!entry || IS_ERR(entry))                            \
-                       goto err;                                       \
        } while (0)
 
 #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type)              \