Commit 3adcfa44 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by David S. Miller

l2tp: 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.

Also, there is no need to store the individual debugfs file name, just
remove the whole directory all at once, saving a local variable.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarGuillaume Nault <gnault@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b55b630
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "l2tp_core.h" #include "l2tp_core.h"
static struct dentry *rootdir; static struct dentry *rootdir;
static struct dentry *tunnels;
struct l2tp_dfs_seq_data { struct l2tp_dfs_seq_data {
struct net *net; struct net *net;
...@@ -326,32 +325,18 @@ static const struct file_operations l2tp_dfs_fops = { ...@@ -326,32 +325,18 @@ static const struct file_operations l2tp_dfs_fops = {
static int __init l2tp_debugfs_init(void) static int __init l2tp_debugfs_init(void)
{ {
int rc = 0;
rootdir = debugfs_create_dir("l2tp", NULL); rootdir = debugfs_create_dir("l2tp", NULL);
if (IS_ERR(rootdir)) {
rc = PTR_ERR(rootdir);
rootdir = NULL;
goto out;
}
tunnels = debugfs_create_file("tunnels", 0600, rootdir, NULL, &l2tp_dfs_fops); debugfs_create_file("tunnels", 0600, rootdir, NULL, &l2tp_dfs_fops);
if (tunnels == NULL)
rc = -EIO;
pr_info("L2TP debugfs support\n"); pr_info("L2TP debugfs support\n");
out: return 0;
if (rc)
pr_warn("unable to init\n");
return rc;
} }
static void __exit l2tp_debugfs_exit(void) static void __exit l2tp_debugfs_exit(void)
{ {
debugfs_remove(tunnels); debugfs_remove_recursive(rootdir);
debugfs_remove(rootdir);
} }
module_init(l2tp_debugfs_init); module_init(l2tp_debugfs_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment