From 812f205962e20f4e4052e42d0009b05988760ef2 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:00 +0200 Subject: [PATCH] staging: lustre: fld: Use !x to check for kzalloc failure !x is more normal for kzalloc failure in the kernel. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; statement S1, S2; @@ x = kzalloc(...); if ( - x == NULL + !x ) S1 else S2 // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lustre/fld/fld_cache.c | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index ec2fc4339a2e..1b1066b2461c 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -70,7 +70,7 @@ struct fld_cache *fld_cache_init(const char *name, LASSERT(cache_threshold < cache_size); cache = kzalloc(sizeof(*cache), GFP_NOFS); - if (cache == NULL) + if (!cache) return ERR_PTR(-ENOMEM); INIT_LIST_HEAD(&cache->fci_entries_head); diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index c3b47f2346df..1e450bf95383 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -222,7 +222,7 @@ int fld_client_add_target(struct lu_client_fld *fld, fld->lcf_name, name, tar->ft_idx); target = kzalloc(sizeof(*target), GFP_NOFS); - if (target == NULL) + if (!target) return -ENOMEM; spin_lock(&fld->lcf_lock); -- 2.34.1