staging: lustre: ldlm: Replace kmem_cache_alloc with kmem_cache_zalloc
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 26 Feb 2016 08:55:02 +0000 (14:25 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2016 03:18:42 +0000 (19:18 -0800)
Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc
with flag GFP_ZERO since kmem_alloc_zalloc sets allocated memory
to zero.

The Coccinelle semantic patch used to make this change is as
follows:
// <smpl>
@@
expression e,f;
@@
- kmem_cache_alloc(e, f |__GFP_ZERO)
+ kmem_cache_zalloc(e, f)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c

index 222cb62fa30b0c6ca028d5b64e4f8733aa4df097..a803e200f2065d8f165bbcb7da5645a594881ac4 100644 (file)
@@ -115,7 +115,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock)
        struct ldlm_interval *node;
 
        LASSERT(lock->l_resource->lr_type == LDLM_EXTENT);
-       node = kmem_cache_alloc(ldlm_interval_slab, GFP_NOFS | __GFP_ZERO);
+       node = kmem_cache_zalloc(ldlm_interval_slab, GFP_NOFS);
        if (!node)
                return NULL;
 
index 98975efc684592cead382b729021446d63e269ce..488523d02d2129ac20fd3ce0a5a905ff22f80861 100644 (file)
@@ -406,7 +406,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource)
 
        LASSERT(resource);
 
-       lock = kmem_cache_alloc(ldlm_lock_slab, GFP_NOFS | __GFP_ZERO);
+       lock = kmem_cache_zalloc(ldlm_lock_slab, GFP_NOFS);
        if (!lock)
                return NULL;
 
index 03b9726d3cbcf4dc37d9df3ad13ff276e9fc5a5d..9dede87ad0a397488ba8169f743f5524bbdf1cd8 100644 (file)
@@ -1041,7 +1041,7 @@ static struct ldlm_resource *ldlm_resource_new(void)
        struct ldlm_resource *res;
        int idx;
 
-       res = kmem_cache_alloc(ldlm_resource_slab, GFP_NOFS | __GFP_ZERO);
+       res = kmem_cache_zalloc(ldlm_resource_slab, GFP_NOFS);
        if (!res)
                return NULL;