linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem.c: Clean code by removing unnecessary assignment
@ 2020-03-01 15:28 mateusznosek0
  2020-03-01 16:54 ` Matthew Wilcox
  2020-03-02  8:54 ` Pankaj Gupta
  0 siblings, 2 replies; 3+ messages in thread
From: mateusznosek0 @ 2020-03-01 15:28 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: Mateusz Nosek, hughd, akpm

From: Mateusz Nosek <mateusznosek0@gmail.com>

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>
---
 mm/shmem.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 31b4bcc95f17..84eb14f5509c 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3116,12 +3116,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;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-02  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-01 15:28 [PATCH] mm/shmem.c: Clean code by removing unnecessary assignment mateusznosek0
2020-03-01 16:54 ` Matthew Wilcox
2020-03-02  8:54 ` Pankaj Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).