aboutsummaryrefslogtreecommitdiffstats
path: root/fs/romfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 16:45:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 16:45:22 -0500
commit7b3480f8b701170c046e1ed362946f5f0d005e13 (patch)
treebd25e05b4f35699689b485480dddf24f840f80af /fs/romfs
parent1c8106528aa6bf16b3f457de80df1cf7462a49a4 (diff)
parentb60ef99c1164a8ad346cf41f9e71acfffb6d25a6 (diff)
Merge tag 'for-linus-3.3' of git://git.infradead.org/mtd-2.6
MTD pull for 3.3 * tag 'for-linus-3.3' of git://git.infradead.org/mtd-2.6: (113 commits) mtd: Fix dependency for MTD_DOC200x mtd: do not use mtd->block_markbad directly logfs: do not use 'mtd->block_isbad' directly mtd: introduce mtd_can_have_bb helper mtd: do not use mtd->suspend and mtd->resume directly mtd: do not use mtd->lock, unlock and is_locked directly mtd: do not use mtd->sync directly mtd: harmonize mtd_writev usage mtd: do not use mtd->lock_user_prot_reg directly mtd: mtd->write_user_prot_reg directly mtd: do not use mtd->read_*_prot_reg directly mtd: do not use mtd->get_*_prot_info directly mtd: do not use mtd->read_oob directly mtd: mtdoops: do not use mtd->panic_write directly romfs: do not use mtd->get_unmapped_area directly mtd: do not use mtd->get_unmapped_area directly mtd: do use mtd->point directly mtd: introduce mtd_has_oob helper mtd: mtdcore: export symbols cleanup mtd: clean-up the default_mtd_writev function ... Fix up trivial edit/remove conflict in drivers/staging/spectra/lld_mtd.c
Diffstat (limited to 'fs/romfs')
-rw-r--r--fs/romfs/mmap-nommu.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/fs/romfs/mmap-nommu.c b/fs/romfs/mmap-nommu.c
index eed99428f104..e1a7779dd3cb 100644
--- a/fs/romfs/mmap-nommu.c
+++ b/fs/romfs/mmap-nommu.c
@@ -28,9 +28,10 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
28 struct inode *inode = file->f_mapping->host; 28 struct inode *inode = file->f_mapping->host;
29 struct mtd_info *mtd = inode->i_sb->s_mtd; 29 struct mtd_info *mtd = inode->i_sb->s_mtd;
30 unsigned long isize, offset, maxpages, lpages; 30 unsigned long isize, offset, maxpages, lpages;
31 int ret;
31 32
32 if (!mtd) 33 if (!mtd)
33 goto cant_map_directly; 34 return (unsigned long) -ENOSYS;
34 35
35 /* the mapping mustn't extend beyond the EOF */ 36 /* the mapping mustn't extend beyond the EOF */
36 lpages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; 37 lpages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -41,23 +42,20 @@ static unsigned long romfs_get_unmapped_area(struct file *file,
41 if ((pgoff >= maxpages) || (maxpages - pgoff < lpages)) 42 if ((pgoff >= maxpages) || (maxpages - pgoff < lpages))
42 return (unsigned long) -EINVAL; 43 return (unsigned long) -EINVAL;
43 44
44 /* we need to call down to the MTD layer to do the actual mapping */ 45 if (addr != 0)
45 if (mtd->get_unmapped_area) { 46 return (unsigned long) -EINVAL;
46 if (addr != 0)
47 return (unsigned long) -EINVAL;
48
49 if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
50 return (unsigned long) -EINVAL;
51 47
52 offset += ROMFS_I(inode)->i_dataoffset; 48 if (len > mtd->size || pgoff >= (mtd->size >> PAGE_SHIFT))
53 if (offset > mtd->size - len) 49 return (unsigned long) -EINVAL;
54 return (unsigned long) -EINVAL;
55 50
56 return mtd->get_unmapped_area(mtd, len, offset, flags); 51 offset += ROMFS_I(inode)->i_dataoffset;
57 } 52 if (offset > mtd->size - len)
53 return (unsigned long) -EINVAL;
58 54
59cant_map_directly: 55 ret = mtd_get_unmapped_area(mtd, len, offset, flags);
60 return (unsigned long) -ENOSYS; 56 if (ret == -EOPNOTSUPP)
57 ret = -ENOSYS;
58 return (unsigned long) ret;
61} 59}
62 60
63/* 61/*