fs/proc/self.c: code cleanup for proc_setup_self()
Remove unnecessary ERR_PTR()/PTR_ERR() cast in proc_setup_self(). Link: http://lkml.kernel.org/r/20190124030150.8472-1-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>
This commit is contained in:
parent
0338c83836
commit
756ca74c7f
@ -38,6 +38,7 @@ int proc_setup_self(struct super_block *s)
|
|||||||
struct inode *root_inode = d_inode(s->s_root);
|
struct inode *root_inode = d_inode(s->s_root);
|
||||||
struct pid_namespace *ns = proc_pid_ns(root_inode);
|
struct pid_namespace *ns = proc_pid_ns(root_inode);
|
||||||
struct dentry *self;
|
struct dentry *self;
|
||||||
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
inode_lock(root_inode);
|
inode_lock(root_inode);
|
||||||
self = d_alloc_name(s->s_root, "self");
|
self = d_alloc_name(s->s_root, "self");
|
||||||
@ -51,20 +52,19 @@ int proc_setup_self(struct super_block *s)
|
|||||||
inode->i_gid = GLOBAL_ROOT_GID;
|
inode->i_gid = GLOBAL_ROOT_GID;
|
||||||
inode->i_op = &proc_self_inode_operations;
|
inode->i_op = &proc_self_inode_operations;
|
||||||
d_add(self, inode);
|
d_add(self, inode);
|
||||||
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
dput(self);
|
dput(self);
|
||||||
self = ERR_PTR(-ENOMEM);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
self = ERR_PTR(-ENOMEM);
|
|
||||||
}
|
}
|
||||||
inode_unlock(root_inode);
|
inode_unlock(root_inode);
|
||||||
if (IS_ERR(self)) {
|
|
||||||
|
if (ret)
|
||||||
pr_err("proc_fill_super: can't allocate /proc/self\n");
|
pr_err("proc_fill_super: can't allocate /proc/self\n");
|
||||||
return PTR_ERR(self);
|
else
|
||||||
}
|
|
||||||
ns->proc_self = self;
|
ns->proc_self = self;
|
||||||
return 0;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init proc_self_init(void)
|
void __init proc_self_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user