crypto: n2 - remove null check before kfree
authorHimanshu Jha <himanshujha199640@gmail.com>
Sat, 26 Aug 2017 21:15:29 +0000 (02:45 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Sep 2017 09:43:25 +0000 (17:43 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/n2_core.c

index a9fd8b9e86cde2961bbd93daf4ec930e6007ea19..48de52cf2ecc10f7a1a33b1fa0025e94ec706a19 100644 (file)
@@ -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);
 }