diff mbox series

[2/2] devpts: simplify devpts_fill_super()

Message ID 20190128171133.539-2-christian@brauner.io (mailing list archive)
State New, archived
Headers show
Series [1/2] devpts: remove unneeded inode_lock in mknod_ptmx | expand

Commit Message

Christian Brauner Jan. 28, 2019, 5:11 p.m. UTC
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@zeniv.linux.org.uk>
Signed-off-by: Christian Brauner <christian@brauner.io>
---
 fs/devpts/inode.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
diff mbox series

Patch

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);
 }
 
 /*