Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chengguang Xu and committed by
Linus Torvalds
45f68ab5 756ca74c

+8 -8
+8 -8
fs/proc/thread_self.c
··· 38 38 struct inode *root_inode = d_inode(s->s_root); 39 39 struct pid_namespace *ns = proc_pid_ns(root_inode); 40 40 struct dentry *thread_self; 41 + int ret = -ENOMEM; 41 42 42 43 inode_lock(root_inode); 43 44 thread_self = d_alloc_name(s->s_root, "thread-self"); ··· 52 51 inode->i_gid = GLOBAL_ROOT_GID; 53 52 inode->i_op = &proc_thread_self_inode_operations; 54 53 d_add(thread_self, inode); 54 + ret = 0; 55 55 } else { 56 56 dput(thread_self); 57 - thread_self = ERR_PTR(-ENOMEM); 58 57 } 59 - } else { 60 - thread_self = ERR_PTR(-ENOMEM); 61 58 } 62 59 inode_unlock(root_inode); 63 - if (IS_ERR(thread_self)) { 60 + 61 + if (ret) 64 62 pr_err("proc_fill_super: can't allocate /proc/thread_self\n"); 65 - return PTR_ERR(thread_self); 66 - } 67 - ns->proc_thread_self = thread_self; 68 - return 0; 63 + else 64 + ns->proc_thread_self = thread_self; 65 + 66 + return ret; 69 67 } 70 68 71 69 void __init proc_thread_self_init(void)