Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Vladimir Zapolskiy and committed by
Brian Norris
b9995932 80bd33ac

+3 -3
+3 -3
drivers/mtd/mtdchar.c
··· 1100 1100 return (unsigned long) -EINVAL; 1101 1101 1102 1102 ret = mtd_get_unmapped_area(mtd, len, offset, flags); 1103 - return ret == -EOPNOTSUPP ? -ENOSYS : ret; 1103 + return ret == -EOPNOTSUPP ? -ENODEV : ret; 1104 1104 } 1105 1105 #endif 1106 1106 ··· 1125 1125 #endif 1126 1126 return vm_iomap_memory(vma, map->phys, map->size); 1127 1127 } 1128 - return -ENOSYS; 1128 + return -ENODEV; 1129 1129 #else 1130 - return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS; 1130 + return vma->vm_flags & VM_SHARED ? 0 : -EACCES; 1131 1131 #endif 1132 1132 } 1133 1133