aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/llite/statahead.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2014-09-18 22:24:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 16:14:01 -0700
commit496a51bd64eb15f14cee3519f5b75b28d09567e3 (patch)
tree9322d97f7a871d3087c9a6da229776e070195673 /drivers/staging/lustre/lustre/llite/statahead.c
parentStaging/bcm: Fix whitespace/comments in Ioctl.h (diff)
downloadlinux-dev-496a51bd64eb15f14cee3519f5b75b28d09567e3.tar.xz
linux-dev-496a51bd64eb15f14cee3519f5b75b28d09567e3.zip
staging: lustre: llite: Use kzalloc and rewrite null tests
This patch removes some kzalloc-related macros and rewrites the associated null tests to use !x rather than x == NULL. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression ptr; statement S,S1; @@ \(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...); if ( + ! ptr - == NULL ) S else S1 @@ expression ptr,size; @@ - OBD_ALLOC(ptr,size) + ptr = kzalloc(size, GFP_NOFS) @@ expression ptr,size; @@ - OBD_ALLOC_WAIT(ptr,size) + ptr = kzalloc(size, GFP_KERNEL) @@ expression ptr,size; @@ - OBD_ALLOC_PTR(ptr) + ptr = kzalloc(sizeof(*ptr), GFP_NOFS) @@ expression ptr,size; @@ - OBD_ALLOC_PTR_WAIT(ptr,size) + ptr = kzalloc(sizeof(*ptr), GFP_KERNEL) // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/statahead.c')
-rw-r--r--drivers/staging/lustre/lustre/llite/statahead.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 85dc6783c049..06b71bcf97a7 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -202,8 +202,8 @@ ll_sa_entry_alloc(struct ll_statahead_info *sai, __u64 index,
char *dname;
entry_size = sizeof(struct ll_sa_entry) + (len & ~3) + 4;
- OBD_ALLOC(entry, entry_size);
- if (unlikely(entry == NULL))
+ entry = kzalloc(entry_size, GFP_NOFS);
+ if (unlikely(!entry))
return ERR_PTR(-ENOMEM);
CDEBUG(D_READA, "alloc sa entry %.*s(%p) index %llu\n",
@@ -465,7 +465,7 @@ static struct ll_statahead_info *ll_sai_alloc(void)
struct ll_statahead_info *sai;
int i;
- OBD_ALLOC_PTR(sai);
+ sai = kzalloc(sizeof(*sai), GFP_NOFS);
if (!sai)
return NULL;
@@ -802,12 +802,12 @@ static int sa_args_init(struct inode *dir, struct inode *child,
struct ldlm_enqueue_info *einfo;
struct md_op_data *op_data;
- OBD_ALLOC_PTR(einfo);
- if (einfo == NULL)
+ einfo = kzalloc(sizeof(*einfo), GFP_NOFS);
+ if (!einfo)
return -ENOMEM;
- OBD_ALLOC_PTR(minfo);
- if (minfo == NULL) {
+ minfo = kzalloc(sizeof(*minfo), GFP_NOFS);
+ if (!minfo) {
OBD_FREE_PTR(einfo);
return -ENOMEM;
}