Skip to content

Commit b999593

Browse files
Vladimir Zapolskiycomputersforpeace
authored andcommitted
mtd: mtdchar: return expected errors on mmap() call
According both to POSIX.1-2008 and Linux Programmer's Manual mmap() syscall shouldn't return undocumented ENOSYS, this change replaces the errno with more appropriate ENODEV and EACCESS. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Cc: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
1 parent 80bd33a commit b999593

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/mtd/mtdchar.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
11001100
return (unsigned long) -EINVAL;
11011101

11021102
ret = mtd_get_unmapped_area(mtd, len, offset, flags);
1103-
return ret == -EOPNOTSUPP ? -ENOSYS : ret;
1103+
return ret == -EOPNOTSUPP ? -ENODEV : ret;
11041104
}
11051105
#endif
11061106

@@ -1125,9 +1125,9 @@ static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
11251125
#endif
11261126
return vm_iomap_memory(vma, map->phys, map->size);
11271127
}
1128-
return -ENOSYS;
1128+
return -ENODEV;
11291129
#else
1130-
return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS;
1130+
return vma->vm_flags & VM_SHARED ? 0 : -EACCES;
11311131
#endif
11321132
}
11331133

0 commit comments

Comments
 (0)