linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: mateusznosek0@gmail.com
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Mateusz Nosek <mateusznosek0@gmail.com>,
	hughd@google.com, akpm@linux-foundation.org
Subject: [PATCH] mm/shmem.c: Clean code by removing unnecessary assignment
Date: Sun,  1 Mar 2020 16:28:32 +0100	[thread overview]
Message-ID: <20200301152832.24595-1-mateusznosek0@gmail.com> (raw)

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



             reply	other threads:[~2020-03-01 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 15:28 mateusznosek0 [this message]
2020-03-01 16:54 ` Matthew Wilcox
2020-03-02  8:54 ` Pankaj Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200301152832.24595-1-mateusznosek0@gmail.com \
    --to=mateusznosek0@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox