Skip to content

Commit

Permalink
crypto: n2 - remove null check before kfree
Browse files Browse the repository at this point in the history
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]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
himanshujha199640 authored and herbertx committed Sep 22, 2017
1 parent 16d5cee commit b8d3de8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/crypto/n2_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit b8d3de8

Please sign in to comment.