Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9995932 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Brian Norris
Browse files

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: default avatarVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 80bd33ac
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1100,7 +1100,7 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
		return (unsigned long) -EINVAL;

	ret = mtd_get_unmapped_area(mtd, len, offset, flags);
	return ret == -EOPNOTSUPP ? -ENOSYS : ret;
	return ret == -EOPNOTSUPP ? -ENODEV : ret;
}
#endif

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