Skip to contentSkip to conversation

crypto: cavium: remove redundant null pointer check before kfree

PATCH In review zhong jiang 2 participants 2 messages Sep 21, 2018 – Sep 28, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: cavium: remove redundant null pointer check before kfree

kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree.

---
 drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/crypto/cavium/cpt/cptvf_reqmanager.c +5 -15
index b0ba433..ca549c5 100644
@@ -308,21 +308,11 @@ void do_request_cleanup(struct cpt_vf *cptvf,
 		}
 	}
 
-	if (info->scatter_components)
-		kzfree(info->scatter_components);
-
-	if (info->gather_components)
-		kzfree(info->gather_components);
-
-	if (info->out_buffer)
-		kzfree(info->out_buffer);
-
-	if (info->in_buffer)
-		kzfree(info->in_buffer);
-
-	if (info->completion_addr)
-		kzfree((void *)info->completion_addr);
-
+	kzfree(info->scatter_components);
+	kzfree(info->gather_components);
+	kzfree(info->out_buffer);
+	kzfree(info->in_buffer);
+	kzfree((void *)info->completion_addr);
 	kzfree(info);
 }
 
Signature · 1 line
1.7.12.4
maintainer
#1 lore raw
Quoted 4 lines · zhong jiang

kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree.

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt