staging: lustre: ptlrpc: Replace kmem_cache_alloc with kmem_cache_zalloc
Author: Amitoj Kaur Chawla <amitoj1606@gmail.com>
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:
//
@@
expression e,f;
@@
- kmem_cache_alloc(e, f |__GFP_ZERO)
+ kmem_cache_zalloc(e, f)
//
Signed-off-by: Amitoj Kaur Chawla
Signed-off-by: Greg Kroah-Hartman
---
drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 0003158..9f65a10 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -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;
} |
---
drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 0003158..9f65a10 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -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;
}