mm: do_mmap_pgoff: cleanup the usage of file_inode()
authorOleg Nesterov <[email protected]>
Wed, 11 Sep 2013 21:20:19 +0000 (14:20 -0700)
committerLinus Torvalds <[email protected]>
Wed, 11 Sep 2013 22:57:07 +0000 (15:57 -0700)
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 <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/mmap.c

index 6cff7ba24a34a1683f3d899718235bef7379c098..1e7a3ea23f1a167f0da576ba9a6a2935d542b71a 100644 (file)
--- 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))