When devpts_fill_super() fails deactivate_locked_super() will cleanup dentries for us so there's no need to do that work in devpts_fill_super() itself. This allows us to simplify that function quite a bit. Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Christian Brauner <christian@xxxxxxxxxx> --- fs/devpts/inode.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 8fa1492f9712..59b7625a2110 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -450,19 +450,18 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_op = &devpts_sops; s->s_time_gran = 1; - error = -ENOMEM; s->s_fs_info = new_pts_fs_info(s); if (!s->s_fs_info) - goto fail; + return -ENOMEM; error = parse_mount_options(data, PARSE_MOUNT, &DEVPTS_SB(s)->mount_opts); if (error) - goto fail; + return error; - error = -ENOMEM; inode = new_inode(s); if (!inode) - goto fail; + return -ENOMEM; + inode->i_ino = 1; inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; @@ -473,19 +472,10 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_root = d_make_root(inode); if (!s->s_root) { pr_err("get root dentry failed\n"); - goto fail; + return -ENOMEM; } - error = mknod_ptmx(s); - if (error) - goto fail_dput; - - return 0; -fail_dput: - dput(s->s_root); - s->s_root = NULL; -fail: - return error; + return mknod_ptmx(s); } /* -- 2.20.1