From 3408e9aeee5fedd0eab223502074cad3120324b0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 20 Jun 2015 18:59:09 +0200 Subject: [PATCH] staging: lustre: osc: 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/osc/osc_dev.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index 9222c9f4faae..91fdec44792b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -218,7 +218,7 @@ static struct lu_device *osc_device_alloc(const struct lu_env *env, int rc; od = kzalloc(sizeof(*od), GFP_NOFS); - if (od == NULL) + if (!od) return ERR_PTR(-ENOMEM); cl_device_init(&od->od_cl, t); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index f84b4c78a8a0..96c80e9bf92d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -119,7 +119,7 @@ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, if (*lmmp == NULL) { *lmmp = kzalloc(lmm_size, GFP_NOFS); - if (*lmmp == NULL) + if (!*lmmp) return -ENOMEM; } @@ -1909,7 +1909,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, mpflag = cfs_memory_pressure_get_and_set(); crattr = kzalloc(sizeof(*crattr), GFP_NOFS); - if (crattr == NULL) { + if (!crattr) { rc = -ENOMEM; goto out; } -- 2.30.2