Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dccp: drop null test before destroy functions

Remove unneeded NULL test.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
@@

-if (x != NULL)
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);

@@
expression x;
@@

-if (x != NULL) {
\(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
x = NULL;
-}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Julia Lawall and committed by
David S. Miller
20471ed4 adf78eda

+5 -10
+4 -8
net/dccp/ackvec.c
··· 398 398 399 399 void dccp_ackvec_exit(void) 400 400 { 401 - if (dccp_ackvec_slab != NULL) { 402 - kmem_cache_destroy(dccp_ackvec_slab); 403 - dccp_ackvec_slab = NULL; 404 - } 405 - if (dccp_ackvec_record_slab != NULL) { 406 - kmem_cache_destroy(dccp_ackvec_record_slab); 407 - dccp_ackvec_record_slab = NULL; 408 - } 401 + kmem_cache_destroy(dccp_ackvec_slab); 402 + dccp_ackvec_slab = NULL; 403 + kmem_cache_destroy(dccp_ackvec_record_slab); 404 + dccp_ackvec_record_slab = NULL; 409 405 }
+1 -2
net/dccp/ccid.c
··· 95 95 96 96 static void ccid_kmem_cache_destroy(struct kmem_cache *slab) 97 97 { 98 - if (slab != NULL) 99 - kmem_cache_destroy(slab); 98 + kmem_cache_destroy(slab); 100 99 } 101 100 102 101 static int __init ccid_activate(struct ccid_operations *ccid_ops)