Commit 3eed2d00 authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Greg Kroah-Hartman

staging: lustre: ldlm: Replace kmem_cache_alloc with kmem_cache_zalloc

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: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c4418dac
...@@ -115,7 +115,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock) ...@@ -115,7 +115,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock)
struct ldlm_interval *node; struct ldlm_interval *node;
LASSERT(lock->l_resource->lr_type == LDLM_EXTENT); 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) if (!node)
return NULL; return NULL;
......
...@@ -406,7 +406,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource) ...@@ -406,7 +406,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource)
LASSERT(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) if (!lock)
return NULL; return NULL;
......
...@@ -1041,7 +1041,7 @@ static struct ldlm_resource *ldlm_resource_new(void) ...@@ -1041,7 +1041,7 @@ static struct ldlm_resource *ldlm_resource_new(void)
struct ldlm_resource *res; struct ldlm_resource *res;
int idx; int idx;
res = kmem_cache_alloc(ldlm_resource_slab, GFP_NOFS | __GFP_ZERO); res = kmem_cache_zalloc(ldlm_resource_slab, GFP_NOFS);
if (!res) if (!res)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment