jfs: mising cleanup on register_filesystem() failure
[firefly-linux-kernel-4.4.55.git] / fs / libfs.c
index 5b2dbb3ba4fca95f3aab72c39f570c16a61c5c02..722e0d5ba182dcfc8f9a4501180b473d265799b2 100644 (file)
@@ -491,11 +491,9 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
        set_nlink(inode, 2);
-       root = d_alloc_root(inode);
-       if (!root) {
-               iput(inode);
+       root = d_make_root(inode);
+       if (!root)
                return -ENOMEM;
-       }
        for (i = 0; !files->name || files->name[0]; i++, files++) {
                if (!files->name)
                        continue;
@@ -536,7 +534,7 @@ int simple_pin_fs(struct file_system_type *type, struct vfsmount **mount, int *c
        spin_lock(&pin_fs_lock);
        if (unlikely(!*mount)) {
                spin_unlock(&pin_fs_lock);
-               mnt = vfs_kern_mount(type, 0, type->name, NULL);
+               mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, NULL);
                if (IS_ERR(mnt))
                        return PTR_ERR(mnt);
                spin_lock(&pin_fs_lock);