Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262471 > unrolled thread

[PATCH] fs-ext4: Delete unnecessary checks before the function call "iput"

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-11-04 19:00 +0100
Last post2015-11-04 19:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] fs-ext4: Delete unnecessary checks before the function call  "iput" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-11-04 19:00 +0100

#1262471 — [PATCH] fs-ext4: Delete unnecessary checks before the function call "iput"

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-11-04 19:00 +0100
Subject[PATCH] fs-ext4: Delete unnecessary checks before the function call "iput"
Message-ID<qravM-3Aq-7@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 4 Nov 2015 18:48:38 +0100

The iput() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/ext4/resize.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index ad62d7a..7918012 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1942,10 +1942,10 @@ retry:
 		err = ext4_convert_meta_bg(sb, resize_inode);
 		if (err)
 			goto out;
-		if (resize_inode) {
-			iput(resize_inode);
-			resize_inode = NULL;
-		}
+
+		iput(resize_inode);
+		resize_inode = NULL;
+
 		if (n_blocks_count_retry) {
 			n_blocks_count = n_blocks_count_retry;
 			n_blocks_count_retry = 0;
@@ -2011,8 +2011,7 @@ retry:
 out:
 	if (flex_gd)
 		free_flex_gd(flex_gd);
-	if (resize_inode != NULL)
-		iput(resize_inode);
+	iput(resize_inode);
 	ext4_msg(sb, KERN_INFO, "resized filesystem to %llu", n_blocks_count);
 	return err;
 }
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web