Linux-Safety Archive mirror
 help / color / mirror / Atom feed
From: Milan Lakhani <milan.lakhani@codethink.co.uk>
To: lukas.bulwahn@gmail.com, linux-safety@lists.elisa.tech,
	nghialm78@gmail.com
Cc: Milan Lakhani <milan.lakhani@codethink.co.uk>
Subject: [PATCH v2] fs/ext4: Remove unecessary deadstores
Date: Mon,  6 Dec 2021 16:03:35 +0000	[thread overview]
Message-ID: <20211206160335.6147-1-milan.lakhani@codethink.co.uk> (raw)
Message-ID: <20211206160335.Rel2hxNaWgpS5QQwbEJ_1Pbvvsqp2ZYBv9U6R9hR7LQ@z> (raw)

Just assigning the 'frame' variable to 'entries2' is sufficient, rather than to
'entries = entries2'. This also removes two other cases where variables are
assigned to values that are never read afterwards, making the code more legible
and efficient.

Signed-off-by: Milan Lakhani <milan.lakhani@codethink.co.uk>
---
 fs/ext4/namei.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 52c9bd154122..fee50ebde197 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2432,7 +2432,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 	if (err != -ENOSPC)
 		goto cleanup;
 
-	err = 0;
 	/* Block full, should compress but for now just split */
 	dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
 		       dx_get_count(entries), dx_get_limit(entries)));
@@ -2507,7 +2506,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
 			/* Which index block gets the new entry? */
 			if (at - entries >= icount1) {
 				frame->at = at - entries - icount1 + entries2;
-				frame->entries = entries = entries2;
+				frame->entries = entries2;
 				swap(frame->bh, bh2);
 			}
 			dx_insert_block((frame - 1), hash2, newblock);
@@ -3183,8 +3182,6 @@ int __ext4_unlink(handle_t *handle, struct inode *dir, const struct qstr *d_name
 		retval = ext4_mark_inode_dirty(handle, dir);
 		if (retval)
 			goto out;
-	} else {
-		retval = 0;
 	}
 	if (inode->i_nlink == 0)
 		ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
-- 
2.25.1



             reply	other threads:[~2021-12-06 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 16:03 Milan Lakhani [this message]
2021-12-06 16:03 ` [PATCH v2] fs/ext4: Remove unecessary deadstores Milan Lakhani

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=20211206160335.6147-1-milan.lakhani@codethink.co.uk \
    --to=milan.lakhani@codethink.co.uk \
    --cc=linux-safety@lists.elisa.tech \
    --cc=lukas.bulwahn@gmail.com \
    --cc=nghialm78@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).