mm/shmem.c: clean code by removing unnecessary assignment
authorMateusz Nosek <mateusznosek0@gmail.com>
Tue, 7 Apr 2020 03:07:54 +0000 (20:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2020 17:43:41 +0000 (10:43 -0700)
Previously 0 was assigned to variable 'error' but the variable was never
read before reassignemnt later.  So the assignment can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Link: http://lkml.kernel.org/r/20200301152832.24595-1-mateusznosek0@gmail.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/shmem.c

index 97448a46a4dcf169292993ce7e2a25a36ce1a7da..e23fea40767ecdab3de63e1a74d006cc7b4d39e4 100644 (file)
@@ -3120,12 +3120,9 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
 
        error = security_inode_init_security(inode, dir, &dentry->d_name,
                                             shmem_initxattrs, NULL);
-       if (error) {
-               if (error != -EOPNOTSUPP) {
-                       iput(inode);
-                       return error;
-               }
-               error = 0;
+       if (error && error != -EOPNOTSUPP) {
+               iput(inode);
+               return error;
        }
 
        inode->i_size = len-1;