From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Date: Wed, 30 Oct 2013 12:08:32 +0000 (+0200)
Subject: sysfs: return correct error code on unimplemented mmap()
X-Git-Tag: firefly_0821_release~176^2~5059^2~2
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1c1365e374bfadf908eae02cded7abb9e672c9d4;p=firefly-linux-kernel-4.4.55.git

sysfs: return correct error code on unimplemented mmap()

Both POSIX.1-2008 and Linux Programmer's Manual have a dedicated return
error code for a case, when a file doesn't support mmap(), it's ENODEV.

This change replaces overloaded EINVAL with ENODEV in a situation
described above for sysfs binary files.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 0d7368d43619..382db3c045f3 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -477,7 +477,6 @@ static int sysfs_bin_mmap(struct file *file, struct vm_area_struct *vma)
 	if (!sysfs_get_active(of->sd))
 		goto out_unlock;
 
-	rc = -EINVAL;
 	if (!battr->mmap)
 		goto out_put;