Skip to content

Commit 45f68ab

Browse files
Chengguang Xutorvalds
authored andcommitted
fs/proc/thread_self.c: code cleanup for proc_setup_thread_self()
Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_thread_self(). Link: http://lkml.kernel.org/r/20190124030150.8472-2-cgxu519@gmx.com Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 756ca74 commit 45f68ab

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/proc/thread_self.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ int proc_setup_thread_self(struct super_block *s)
3838
struct inode *root_inode = d_inode(s->s_root);
3939
struct pid_namespace *ns = proc_pid_ns(root_inode);
4040
struct dentry *thread_self;
41+
int ret = -ENOMEM;
4142

4243
inode_lock(root_inode);
4344
thread_self = d_alloc_name(s->s_root, "thread-self");
@@ -51,20 +52,19 @@ int proc_setup_thread_self(struct super_block *s)
5152
inode->i_gid = GLOBAL_ROOT_GID;
5253
inode->i_op = &proc_thread_self_inode_operations;
5354
d_add(thread_self, inode);
55+
ret = 0;
5456
} else {
5557
dput(thread_self);
56-
thread_self = ERR_PTR(-ENOMEM);
5758
}
58-
} else {
59-
thread_self = ERR_PTR(-ENOMEM);
6059
}
6160
inode_unlock(root_inode);
62-
if (IS_ERR(thread_self)) {
61+
62+
if (ret)
6363
pr_err("proc_fill_super: can't allocate /proc/thread_self\n");
64-
return PTR_ERR(thread_self);
65-
}
66-
ns->proc_thread_self = thread_self;
67-
return 0;
64+
else
65+
ns->proc_thread_self = thread_self;
66+
67+
return ret;
6868
}
6969

7070
void __init proc_thread_self_init(void)

0 commit comments

Comments
 (0)