diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-09-11 17:20:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:57:07 -0400 |
commit | 077bf22b5cf233863826afbfa4af9b18650a832d (patch) | |
tree | d071057c3a68f9c19ccb31108a65f56b6e761341 /mm/mmap.c | |
parent | b2c56e4f7d93be3f33a82ec66f0d0f46713ff5f1 (diff) |
mm: do_mmap_pgoff: cleanup the usage of file_inode()
Simple cleanup. Move "struct inode *inode" variable into "if (file)"
block to simplify the code and avoid the unnecessary check.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Colin Cross <ccross@android.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1202,7 +1202,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1202 | unsigned long *populate) | 1202 | unsigned long *populate) |
1203 | { | 1203 | { |
1204 | struct mm_struct * mm = current->mm; | 1204 | struct mm_struct * mm = current->mm; |
1205 | struct inode *inode; | ||
1206 | vm_flags_t vm_flags; | 1205 | vm_flags_t vm_flags; |
1207 | 1206 | ||
1208 | *populate = 0; | 1207 | *populate = 0; |
@@ -1265,9 +1264,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1265 | return -EAGAIN; | 1264 | return -EAGAIN; |
1266 | } | 1265 | } |
1267 | 1266 | ||
1268 | inode = file ? file_inode(file) : NULL; | ||
1269 | |||
1270 | if (file) { | 1267 | if (file) { |
1268 | struct inode *inode = file_inode(file); | ||
1269 | |||
1271 | switch (flags & MAP_TYPE) { | 1270 | switch (flags & MAP_TYPE) { |
1272 | case MAP_SHARED: | 1271 | case MAP_SHARED: |
1273 | if ((prot&PROT_WRITE) && !(file->f_mode&FMODE_WRITE)) | 1272 | if ((prot&PROT_WRITE) && !(file->f_mode&FMODE_WRITE)) |