summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-26 08:54:27 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-02 03:18:42 (GMT)
commit99815cb579647a93eaf655933a5cfe1f3fd8488c (patch)
tree1173bef6b6ec8fd141ec9d2a2339b13e6e8ff048
parent3dd842896bdfe0acbe0088c20b5f8be581b0e690 (diff)
downloadlinux-99815cb579647a93eaf655933a5cfe1f3fd8488c.tar.xz
staging: lustre: obdclass: 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: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/obdclass/cl_lock.c2
-rw-r--r--drivers/staging/lustre/lustre/obdclass/cl_object.c2
-rw-r--r--drivers/staging/lustre/lustre/obdclass/genops.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
index 6cf284b..f40a2ec 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c
@@ -361,7 +361,7 @@ static struct cl_lock *cl_lock_alloc(const struct lu_env *env,
struct cl_lock *lock;
struct lu_object_header *head;
- lock = kmem_cache_alloc(cl_lock_kmem, GFP_NOFS | __GFP_ZERO);
+ lock = kmem_cache_zalloc(cl_lock_kmem, GFP_NOFS);
if (lock) {
atomic_set(&lock->cll_ref, 1);
lock->cll_descr = *descr;
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c
index e7c570a..43e299d 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c
@@ -659,7 +659,7 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)
struct lu_env *env;
struct cl_env *cle;
- cle = kmem_cache_alloc(cl_env_kmem, GFP_NOFS | __GFP_ZERO);
+ cle = kmem_cache_zalloc(cl_env_kmem, GFP_NOFS);
if (cle) {
int rc;
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 65f2c62..cf97b8f0 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -69,7 +69,7 @@ static struct obd_device *obd_device_alloc(void)
{
struct obd_device *obd;
- obd = kmem_cache_alloc(obd_device_cachep, GFP_NOFS | __GFP_ZERO);
+ obd = kmem_cache_zalloc(obd_device_cachep, GFP_NOFS);
if (obd)
obd->obd_magic = OBD_DEVICE_MAGIC;
return obd;