]> git.hungrycats.org Git - linux/commitdiff
[PATCH] prepare for 32-bit dev_t: jffs2 cleanups
authorAlexander Viro <viro@www.linux.org.uk>
Tue, 23 Sep 2003 05:51:07 +0000 (22:51 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 23 Sep 2003 05:51:07 +0000 (22:51 -0700)
Minor cleanup of jffs2 fill_super.

fs/jffs2/super.c

index ed5480b71982f7c92d3fe03aa721ee841969ff75..cc55f6176f9bd66ce81b2801a1c37373233fa4a5 100644 (file)
@@ -173,7 +173,6 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
        int err;
        struct nameidata nd;
        int mtdnr;
-       dev_t dev;
 
        if (!dev_name)
                return ERR_PTR(-EINVAL);
@@ -227,26 +226,31 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
        if (err)
                return ERR_PTR(err);
 
-       if (!S_ISBLK(nd.dentry->d_inode->i_mode)) {
-               path_release(&nd);
-               return ERR_PTR(-EINVAL);
-       }
+       err = -EINVAL;
+
+       if (!S_ISBLK(nd.dentry->d_inode->i_mode))
+               goto out;
+
        if (nd.mnt->mnt_flags & MNT_NODEV) {
-               path_release(&nd);
-               return ERR_PTR(-EACCES);
+               err = -EACCES;
+               goto out;
        }
 
-       dev = nd.dentry->d_inode->i_rdev;
-       path_release(&nd);
-
-       if (MAJOR(dev) != MTD_BLOCK_MAJOR) {
+       if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) {
                if (!(flags & MS_VERBOSE)) /* Yes I mean this. Strangely */
                        printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n",
                               dev_name);
-               return ERR_PTR(-EINVAL);
+               goto out;
        }
 
-       return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, MINOR(dev));
+       mtdnr = iminor(nd.dentry->d_inode);
+       path_release(&nd);
+
+       return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr);
+
+out:
+       path_release(&nd);
+       return ERR_PTR(err);
 }