Commit 979cd1d1 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] prepare for 32-bit dev_t: jffs2 cleanups

	Minor cleanup of jffs2 fill_super.
parent 9cc36375
...@@ -173,7 +173,6 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, ...@@ -173,7 +173,6 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
int err; int err;
struct nameidata nd; struct nameidata nd;
int mtdnr; int mtdnr;
dev_t dev;
if (!dev_name) if (!dev_name)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -227,26 +226,31 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, ...@@ -227,26 +226,31 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
if (!S_ISBLK(nd.dentry->d_inode->i_mode)) { err = -EINVAL;
path_release(&nd);
return ERR_PTR(-EINVAL); if (!S_ISBLK(nd.dentry->d_inode->i_mode))
} goto out;
if (nd.mnt->mnt_flags & MNT_NODEV) { if (nd.mnt->mnt_flags & MNT_NODEV) {
path_release(&nd); err = -EACCES;
return ERR_PTR(-EACCES); goto out;
} }
dev = nd.dentry->d_inode->i_rdev; if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) {
path_release(&nd);
if (MAJOR(dev) != MTD_BLOCK_MAJOR) {
if (!(flags & MS_VERBOSE)) /* Yes I mean this. Strangely */ if (!(flags & MS_VERBOSE)) /* Yes I mean this. Strangely */
printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n", printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n",
dev_name); 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);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment