summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-09-11 14:20:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 15:57:07 -0700
commit077bf22b5cf233863826afbfa4af9b18650a832d (patch)
treed071057c3a68f9c19ccb31108a65f56b6e761341
parentb2c56e4f7d93be3f33a82ec66f0d0f46713ff5f1 (diff)
downloadop-kernel-dev-077bf22b5cf233863826afbfa4af9b18650a832d.zip
op-kernel-dev-077bf22b5cf233863826afbfa4af9b18650a832d.tar.gz
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>
-rw-r--r--mm/mmap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 6cff7ba..1e7a3ea 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1202,7 +1202,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
unsigned long *populate)
{
struct mm_struct * mm = current->mm;
- struct inode *inode;
vm_flags_t vm_flags;
*populate = 0;
@@ -1265,9 +1264,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
return -EAGAIN;
}
- inode = file ? file_inode(file) : NULL;
-
if (file) {
+ struct inode *inode = file_inode(file);
+
switch (flags & MAP_TYPE) {
case MAP_SHARED:
if ((prot&PROT_WRITE) && !(file->f_mode&FMODE_WRITE))
OpenPOWER on IntegriCloud