crypto: starfive - Remove unneeded NULL checks
authorJia Jie Ho <jiajie.ho@starfivetech.com>
Mon, 4 Dec 2023 03:02:39 +0000 (11:02 +0800)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 19 Feb 2024 00:14:01 +0000 (09:14 +0900)
NULL check before kfree_sensitive function is not needed.

Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311301702.LxswfETY-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from mainline commit 555e387047761eb909a0a1a8230efad3fa3e82ca)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I2b868f089ac0bf9fa49bf2657f3fea98fa5c2cfa

drivers/crypto/starfive/jh7110-rsa.c

index c2b1f598873c2bbd8448a5a6a4ab4aef2e55b3f9..cf8bda7f0855d911bbc46734fbf69b084c443bfa 100644 (file)
@@ -45,12 +45,9 @@ static inline int starfive_pka_wait_done(struct starfive_cryp_ctx *ctx)
 
 static void starfive_rsa_free_key(struct starfive_rsa_key *key)
 {
-       if (key->d)
-               kfree_sensitive(key->d);
-       if (key->e)
-               kfree_sensitive(key->e);
-       if (key->n)
-               kfree_sensitive(key->n);
+       kfree_sensitive(key->d);
+       kfree_sensitive(key->e);
+       kfree_sensitive(key->n);
        memset(key, 0, sizeof(*key));
 }