dccp: drop null test before destroy functions
authorJulia Lawall <julia.lawall@lip6.fr>
Sun, 13 Sep 2015 12:15:27 +0000 (14:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Sep 2015 23:49:43 +0000 (16:49 -0700)
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>
net/dccp/ackvec.c
net/dccp/ccid.c

index bd9e718..3de0d03 100644 (file)
@@ -398,12 +398,8 @@ out_err:
 
 void dccp_ackvec_exit(void)
 {
-       if (dccp_ackvec_slab != NULL) {
-               kmem_cache_destroy(dccp_ackvec_slab);
-               dccp_ackvec_slab = NULL;
-       }
-       if (dccp_ackvec_record_slab != NULL) {
-               kmem_cache_destroy(dccp_ackvec_record_slab);
-               dccp_ackvec_record_slab = NULL;
-       }
+       kmem_cache_destroy(dccp_ackvec_slab);
+       dccp_ackvec_slab = NULL;
+       kmem_cache_destroy(dccp_ackvec_record_slab);
+       dccp_ackvec_record_slab = NULL;
 }
index 8349897..90f77d0 100644 (file)
@@ -95,8 +95,7 @@ static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_f
 
 static void ccid_kmem_cache_destroy(struct kmem_cache *slab)
 {
-       if (slab != NULL)
-               kmem_cache_destroy(slab);
+       kmem_cache_destroy(slab);
 }
 
 static int __init ccid_activate(struct ccid_operations *ccid_ops)