linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
@ 2014-11-15 18:19                                   ` SF Markus Elfring
  2014-11-26  1:16                                     ` [1/1] " Theodore Ts'o
  2014-11-16 22:40                                   ` [PATCH 1/1] fs-jbd: " SF Markus Elfring
                                                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2014-11-15 18:19 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Ts'o, linux-ext4
  Cc: linux-kernel, kernel-janitors, trivial, Coccinelle

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 15 Nov 2014 19:04:06 +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/mballoc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 8b0f9ef..e1a2521 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2712,8 +2712,7 @@ int ext4_mb_release(struct super_block *sb)
 	}
 	kfree(sbi->s_mb_offsets);
 	kfree(sbi->s_mb_maxs);
-	if (sbi->s_buddy_cache)
-		iput(sbi->s_buddy_cache);
+	iput(sbi->s_buddy_cache);
 	if (sbi->s_mb_stats) {
 		ext4_msg(sb, KERN_INFO,
 		       "mballoc: %u blocks %u reqs (%u success)",
-- 
2.1.3



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

* [PATCH 1/1] fs-jbd: Deletion of an unnecessary check before the function call "iput"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
  2014-11-15 18:19                                   ` [PATCH 1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
@ 2014-11-16 22:40                                   ` SF Markus Elfring
  2014-11-18  9:16                                     ` Jan Kara
  2015-06-26 14:16                                   ` [PATCH] keys: Delete an unnecessary check before the function call "key_put" SF Markus Elfring
  2015-11-04 17:57                                   ` [PATCH] fs-ext4: Delete unnecessary checks before the function call "iput" SF Markus Elfring
  3 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2014-11-16 22:40 UTC (permalink / raw)
  To: Andrew Morton, Jan Kara, linux-ext4; +Cc: LKML, kernel-janitors, Coccinelle

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 16 Nov 2014 23:23:19 +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/jbd/journal.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 06fe11e..32fe03e 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1373,8 +1373,7 @@ int journal_destroy(journal_t *journal)
 	}
 	mutex_unlock(&journal->j_checkpoint_mutex);
 
-	if (journal->j_inode)
-		iput(journal->j_inode);
+	iput(journal->j_inode);
 	if (journal->j_revoke)
 		journal_destroy_revoke(journal);
 	kfree(journal->j_wbuf);
-- 
2.1.3

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

* Re: [PATCH 1/1] fs-jbd: Deletion of an unnecessary check before the function call "iput"
  2014-11-16 22:40                                   ` [PATCH 1/1] fs-jbd: " SF Markus Elfring
@ 2014-11-18  9:16                                     ` Jan Kara
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kara @ 2014-11-18  9:16 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Andrew Morton, Jan Kara, linux-ext4, LKML, kernel-janitors,
	Coccinelle

On Sun 16-11-14 23:40:18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 16 Nov 2014 23:23:19 +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/jbd/journal.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
  Thanks. Merged into my tree.

								Honza

> 
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index 06fe11e..32fe03e 100644
> --- a/fs/jbd/journal.c
> +++ b/fs/jbd/journal.c
> @@ -1373,8 +1373,7 @@ int journal_destroy(journal_t *journal)
>  	}
>  	mutex_unlock(&journal->j_checkpoint_mutex);
>  
> -	if (journal->j_inode)
> -		iput(journal->j_inode);
> +	iput(journal->j_inode);
>  	if (journal->j_revoke)
>  		journal_destroy_revoke(journal);
>  	kfree(journal->j_wbuf);
> -- 
> 2.1.3
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* Re: [1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput"
  2014-11-15 18:19                                   ` [PATCH 1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
@ 2014-11-26  1:16                                     ` Theodore Ts'o
  0 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2014-11-26  1:16 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Andreas Dilger, linux-ext4, linux-kernel, kernel-janitors,
	trivial, Coccinelle

On Sat, Nov 15, 2014 at 07:19:36PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 15 Nov 2014 19:04:06 +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>

Thanks, applied.

						- Ted

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

* [PATCH] keys: Delete an unnecessary check before the function call "key_put"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
  2014-11-15 18:19                                   ` [PATCH 1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
  2014-11-16 22:40                                   ` [PATCH 1/1] fs-jbd: " SF Markus Elfring
@ 2015-06-26 14:16                                   ` SF Markus Elfring
  2015-06-26 14:21                                     ` [PATCH] fs-ext4 crypto: " SF Markus Elfring
  2015-11-04 17:57                                   ` [PATCH] fs-ext4: Delete unnecessary checks before the function call "iput" SF Markus Elfring
  3 siblings, 1 reply; 7+ messages in thread
From: SF Markus Elfring @ 2015-06-26 14:16 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Ts'o, linux-ext4
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 26 Jun 2015 16:10:54 +0200

The key_put() 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/crypto_key.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index 442d24e..f8d15ae 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -89,8 +89,7 @@ void ext4_free_crypt_info(struct ext4_crypt_info *ci)
 	if (!ci)
 		return;
 
-	if (ci->ci_keyring_key)
-		key_put(ci->ci_keyring_key);
+	key_put(ci->ci_keyring_key);
 	crypto_free_ablkcipher(ci->ci_ctfm);
 	kmem_cache_free(ext4_crypt_info_cachep, ci);
 }
-- 
2.4.4

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

* [PATCH] fs-ext4 crypto: Delete an unnecessary check before the function call "key_put"
  2015-06-26 14:16                                   ` [PATCH] keys: Delete an unnecessary check before the function call "key_put" SF Markus Elfring
@ 2015-06-26 14:21                                     ` SF Markus Elfring
  0 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2015-06-26 14:21 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Ts'o, linux-ext4
  Cc: LKML, kernel-janitors, Julia Lawall

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 26 Jun 2015 16:10:54 +0200
Subject: [PATCH] fs-ext4 crypto: Delete an unnecessary check before the
 function call "key_put"

The key_put() 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/crypto_key.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index 442d24e..f8d15ae 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -89,8 +89,7 @@ void ext4_free_crypt_info(struct ext4_crypt_info *ci)
 	if (!ci)
 		return;
 
-	if (ci->ci_keyring_key)
-		key_put(ci->ci_keyring_key);
+	key_put(ci->ci_keyring_key);
 	crypto_free_ablkcipher(ci->ci_ctfm);
 	kmem_cache_free(ext4_crypt_info_cachep, ci);
 }
-- 
2.4.4

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

* [PATCH] fs-ext4: Delete unnecessary checks before the function call "iput"
       [not found]                                 ` <5317A59D.4@users.sourceforge.net>
                                                     ` (2 preceding siblings ...)
  2015-06-26 14:16                                   ` [PATCH] keys: Delete an unnecessary check before the function call "key_put" SF Markus Elfring
@ 2015-11-04 17:57                                   ` SF Markus Elfring
  3 siblings, 0 replies; 7+ messages in thread
From: SF Markus Elfring @ 2015-11-04 17:57 UTC (permalink / raw)
  To: Andreas Dilger, Theodore Ts'o, linux-ext4
  Cc: LKML, kernel-janitors, Julia Lawall

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

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

end of thread, other threads:[~2015-11-04 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5307CAA2.8060406@users.sourceforge.net>
     [not found] ` <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6>
     [not found]   ` <530A086E.8010901@users.sourceforge.net>
     [not found]     ` <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6>
     [not found]       ` <530A72AA.3000601@users.sourceforge.net>
     [not found]         ` <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6>
     [not found]           ` <530B5FB6.6010207@users.sourceforge.net>
     [not found]             ` <alpine.DEB.2.10.1402241710370.2074@hadrien>
     [not found]               ` <530C5E18.1020800@users.sourceforge.net>
     [not found]                 ` <alpine.DEB.2.10.1402251014170.2080@hadrien>
     [not found]                   ` <530CD2C4.4050903@users.sourceforge.net>
     [not found]                     ` <alpine.DEB.2.10.1402251840450.7035@hadrien>
     [not found]                       ` <530CF8FF.8080600@users.sourceforge.net>
     [not found]                         ` <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6>
     [not found]                           ` <530DD06F.4090703@users.sourceforge.net>
     [not found]                             ` <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6>
     [not found]                               ` <5317A59D.4@users.so urceforge.net>
     [not found]                                 ` <5317A59D.4@users.sourceforge.net>
2014-11-15 18:19                                   ` [PATCH 1/1] fs-ext4: Deletion of an unnecessary check before the function call "iput" SF Markus Elfring
2014-11-26  1:16                                     ` [1/1] " Theodore Ts'o
2014-11-16 22:40                                   ` [PATCH 1/1] fs-jbd: " SF Markus Elfring
2014-11-18  9:16                                     ` Jan Kara
2015-06-26 14:16                                   ` [PATCH] keys: Delete an unnecessary check before the function call "key_put" SF Markus Elfring
2015-06-26 14:21                                     ` [PATCH] fs-ext4 crypto: " SF Markus Elfring
2015-11-04 17:57                                   ` [PATCH] fs-ext4: Delete unnecessary checks before the function call "iput" SF Markus Elfring

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).