Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1771ffa authored by Al Viro's avatar Al Viro
Browse files

Simplify failure exits in s390/hypfs fill_super()



->kill_sb() will be called after any failure exit, so no need
to duplicate what it can do.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent fc7bed8c
Loading
Loading
Loading
Loading
+13 −29
Original line number Original line Diff line number Diff line
@@ -288,46 +288,30 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
	sb->s_magic = HYPFS_MAGIC;
	sb->s_magic = HYPFS_MAGIC;
	sb->s_op = &hypfs_s_ops;
	sb->s_op = &hypfs_s_ops;
	if (hypfs_parse_options(data, sb)) {
	if (hypfs_parse_options(data, sb))
		rc = -EINVAL;
		return -EINVAL;
		goto err_alloc;
	}
	root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
	root_inode = hypfs_make_inode(sb, S_IFDIR | 0755);
	if (!root_inode) {
	if (!root_inode)
		rc = -ENOMEM;
		return -ENOMEM;
		goto err_alloc;
	}
	root_inode->i_op = &simple_dir_inode_operations;
	root_inode->i_op = &simple_dir_inode_operations;
	root_inode->i_fop = &simple_dir_operations;
	root_inode->i_fop = &simple_dir_operations;
	root_dentry = d_alloc_root(root_inode);
	sb->s_root = root_dentry = d_alloc_root(root_inode);
	if (!root_dentry) {
	if (!root_dentry) {
		iput(root_inode);
		iput(root_inode);
		rc = -ENOMEM;
		return -ENOMEM;
		goto err_alloc;
	}
	}
	if (MACHINE_IS_VM)
	if (MACHINE_IS_VM)
		rc = hypfs_vm_create_files(sb, root_dentry);
		rc = hypfs_vm_create_files(sb, root_dentry);
	else
	else
		rc = hypfs_diag_create_files(sb, root_dentry);
		rc = hypfs_diag_create_files(sb, root_dentry);
	if (rc)
	if (rc)
		goto err_tree;
		return rc;
	sbi->update_file = hypfs_create_update_file(sb, root_dentry);
	sbi->update_file = hypfs_create_update_file(sb, root_dentry);
	if (IS_ERR(sbi->update_file)) {
	if (IS_ERR(sbi->update_file))
		rc = PTR_ERR(sbi->update_file);
		return PTR_ERR(sbi->update_file);
		goto err_tree;
	}
	hypfs_update_update(sb);
	hypfs_update_update(sb);
	sb->s_root = root_dentry;
	pr_info("Hypervisor filesystem mounted\n");
	pr_info("Hypervisor filesystem mounted\n");
	return 0;
	return 0;

err_tree:
	hypfs_delete_tree(root_dentry);
	d_genocide(root_dentry);
	dput(root_dentry);
err_alloc:
	kfree(sbi);
	return rc;
}
}


static int hypfs_get_super(struct file_system_type *fst, int flags,
static int hypfs_get_super(struct file_system_type *fst, int flags,
@@ -340,12 +324,12 @@ static void hypfs_kill_super(struct super_block *sb)
{
{
	struct hypfs_sb_info *sb_info = sb->s_fs_info;
	struct hypfs_sb_info *sb_info = sb->s_fs_info;


	if (sb->s_root) {
	if (sb->s_root)
		hypfs_delete_tree(sb->s_root);
		hypfs_delete_tree(sb->s_root);
	if (sb_info->update_file)
		hypfs_remove(sb_info->update_file);
		hypfs_remove(sb_info->update_file);
	kfree(sb->s_fs_info);
	kfree(sb->s_fs_info);
	sb->s_fs_info = NULL;
	sb->s_fs_info = NULL;
	}
	kill_litter_super(sb);
	kill_litter_super(sb);
}
}