Hmm.. I think it's kind of stupid adding that special case early on, just
to get one particular error case return when there are multiple possible
ones.
I don't care deeply, but this does smell like a test issue rather than a
code issue.
Looking at that path, there are *other* things that might be worth
cleaning up, but this wasn't one of them..
Linus
---
diff --git a/mm/mmap.c b/mm/mmap.c
index facc1a7..fe286f7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -893,7 +893,6 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
unsigned long flags, unsigned long pgoff)
{
struct mm_struct * mm = current->mm;
- struct inode *inode;
unsigned int vm_flags;
int error;
int accountable = 1;
@@ -959,9 +958,9 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
return -EAGAIN;
}
- inode = file ? file->f_path.dentry->d_inode : NULL;
-
if (file) {
+ struct inode *inode = file->f_path.dentry->d_inode;
+
switch (flags & MAP_TYPE) {
case MAP_SHARED:
if ((prot&PROT_WRITE) && !(file->f_mode&FMODE_WRITE))
-