*** BLURB HERE ***
Himanshu Jha (2):
crypto: n2 - remove null check before kfree
crypto: inside-secure - remove null check before kfree
drivers/crypto/inside-secure/safexcel_hash.c | 6 ++----
drivers/crypto/n2_core.c | 12 ++++--------
2 files changed, 6 insertions(+), 12 deletions(-)
--
2.7.4
kfree on NULL pointer is a no-op and therefore checking it is redundant.
Signed-off-by: Himanshu Jha <[email protected]>
---
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
Kfree on NULL pointer is a no-op and therefore checking is redundant.
Signed-off-by: Himanshu Jha <[email protected]>
---
drivers/crypto/inside-secure/safexcel_hash.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index 3f81939..9c32bbb 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -308,10 +308,8 @@ static int safexcel_ahash_send(struct crypto_async_request *async, int ring,
ctx->base.cache_sz = 0;
}
free_cache:
- if (ctx->base.cache) {
- kfree(ctx->base.cache);
- ctx->base.cache = NULL;
- }
+ kfree(ctx->base.cache);
+ ctx->base.cache = NULL;
unlock:
spin_unlock_bh(&priv->ring[ring].egress_lock);
--
2.7.4
From: Himanshu Jha <[email protected]>
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 <[email protected]>
Acked-by: David S. Miller <[email protected]>
On Sun, Aug 27, 2017 at 02:45:28AM +0530, Himanshu Jha wrote:
> *** BLURB HERE ***
>
> Himanshu Jha (2):
> crypto: n2 - remove null check before kfree
> crypto: inside-secure - remove null check before kfree
All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt