procfs: clean proc_fill_super() up
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 13 Feb 2012 02:56:08 +0000 (21:56 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 21 Mar 2012 01:29:34 +0000 (21:29 -0400)
First of all, there's no need to zero ->i_uid/->i_gid on root inode -
both had been set to zero already.  Moreover, let's take the iput()
on failure to the failure exit it belongs to...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/proc/inode.c

index 84fd3235a5902b73eb59dbc9d18d42be4969b3a3..a70af3a44f45e913ed6d182a17d619d7df1c2b07 100644 (file)
@@ -499,16 +499,15 @@ int proc_fill_super(struct super_block *s)
        root_inode = proc_get_inode(s, &proc_root);
        if (!root_inode)
                goto out_no_root;
-       root_inode->i_uid = 0;
-       root_inode->i_gid = 0;
        s->s_root = d_alloc_root(root_inode);
-       if (!s->s_root)
+       if (!s->s_root) {
+               iput(root_inode);
                goto out_no_root;
+       }
        return 0;
 
 out_no_root:
        printk("proc_read_super: get root inode failed\n");
-       iput(root_inode);
        pde_put(&proc_root);
        return -ENOMEM;
 }