staging: lustre: ptlrpc: Replace kmem_cache_alloc with kmem_cache_zalloc
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 26 Feb 2016 08:54:48 +0000 (14:24 +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/ptlrpc/client.c

index 0003158f362cc8d169a7f2e749e135fcbbc271bf..9f65a10018c02adf8625a807a7032875e1441d67 100644 (file)
@@ -423,7 +423,7 @@ struct ptlrpc_request *ptlrpc_request_cache_alloc(gfp_t flags)
 {
        struct ptlrpc_request *req;
 
-       req = kmem_cache_alloc(request_cache, flags | __GFP_ZERO);
+       req = kmem_cache_zalloc(request_cache, flags);
        return req;
 }