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


Groups > linux.kernel > #1720709 > unrolled thread

[PATCH 1/2] crypto: n2 - remove null check before kfree

Started byHimanshu Jha <himanshujha199640@gmail.com>
First post2017-08-26 23:20 +0200
Last post2017-08-27 04:00 +0200
Articles 2 — 2 participants

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 1/2] crypto: n2 - remove null check before kfree Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-26 23:20 +0200
    Re: [PATCH 1/2] crypto: n2 - remove null check before kfree David Miller <davem@davemloft.net> - 2017-08-27 04:00 +0200

#1720709 — [PATCH 1/2] crypto: n2 - remove null check before kfree

FromHimanshu Jha <himanshujha199640@gmail.com>
Date2017-08-26 23:20 +0200
Subject[PATCH 1/2] crypto: n2 - remove null check before kfree
Message-ID<uiQEN-6qp-1@gated-at.bofh.it>
kfree on NULL pointer is a no-op and therefore checking it is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/crypto/n2_core.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index a9fd8b9..48de52c 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -1962,10 +1962,8 @@ static struct n2_crypto *alloc_n2cp(void)
 
 static void free_n2cp(struct n2_crypto *np)
 {
-	if (np->cwq_info.ino_table) {
-		kfree(np->cwq_info.ino_table);
-		np->cwq_info.ino_table = NULL;
-	}
+	kfree(np->cwq_info.ino_table);
+	np->cwq_info.ino_table = NULL;
 
 	kfree(np);
 }
@@ -2079,10 +2077,8 @@ static struct n2_mau *alloc_ncp(void)
 
 static void free_ncp(struct n2_mau *mp)
 {
-	if (mp->mau_info.ino_table) {
-		kfree(mp->mau_info.ino_table);
-		mp->mau_info.ino_table = NULL;
-	}
+	kfree(mp->mau_info.ino_table);
+	mp->mau_info.ino_table = NULL;
 
 	kfree(mp);
 }
-- 
2.7.4

[toc] | [next] | [standalone]


#1720727

FromDavid Miller <davem@davemloft.net>
Date2017-08-27 04:00 +0200
Message-ID<uiV1L-Fm-3@gated-at.bofh.it>
In reply to#1720709
From: Himanshu Jha <himanshujha199640@gmail.com>
Date: Sun, 27 Aug 2017 02:45:29 +0530

> kfree on NULL pointer is a no-op and therefore checking it is redundant.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

Acked-by: David S. Miller <davem@davemloft.net>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web