aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdsuper.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 9b6af7e74a65..00d46e137b2a 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -125,8 +125,11 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
125 int (*fill_super)(struct super_block *, void *, int), 125 int (*fill_super)(struct super_block *, void *, int),
126 struct vfsmount *mnt) 126 struct vfsmount *mnt)
127{ 127{
128#ifdef CONFIG_BLOCK
128 struct block_device *bdev; 129 struct block_device *bdev;
129 int mtdnr, ret; 130 int ret, major;
131#endif
132 int mtdnr;
130 133
131 if (!dev_name) 134 if (!dev_name)
132 return -EINVAL; 135 return -EINVAL;
@@ -178,6 +181,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
178 } 181 }
179 } 182 }
180 183
184#ifdef CONFIG_BLOCK
181 /* try the old way - the hack where we allowed users to mount 185 /* try the old way - the hack where we allowed users to mount
182 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev 186 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
183 */ 187 */
@@ -190,22 +194,25 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
190 DEBUG(1, "MTDSB: lookup_bdev() returned 0\n"); 194 DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
191 195
192 ret = -EINVAL; 196 ret = -EINVAL;
193 if (MAJOR(bdev->bd_dev) != MTD_BLOCK_MAJOR)
194 goto not_an_MTD_device;
195 197
198 major = MAJOR(bdev->bd_dev);
196 mtdnr = MINOR(bdev->bd_dev); 199 mtdnr = MINOR(bdev->bd_dev);
197 bdput(bdev); 200 bdput(bdev);
198 201
202 if (major != MTD_BLOCK_MAJOR)
203 goto not_an_MTD_device;
204
199 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 205 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
200 mnt); 206 mnt);
201 207
202not_an_MTD_device: 208not_an_MTD_device:
209#endif /* CONFIG_BLOCK */
210
203 if (!(flags & MS_SILENT)) 211 if (!(flags & MS_SILENT))
204 printk(KERN_NOTICE 212 printk(KERN_NOTICE
205 "MTD: Attempt to mount non-MTD device \"%s\"\n", 213 "MTD: Attempt to mount non-MTD device \"%s\"\n",
206 dev_name); 214 dev_name);
207 bdput(bdev); 215 return -EINVAL;
208 return ret;
209} 216}
210 217
211EXPORT_SYMBOL_GPL(get_sb_mtd); 218EXPORT_SYMBOL_GPL(get_sb_mtd);