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>
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;
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;
{
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;