staging: lustre: lclient: Use !x to check for kzalloc failure
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 20 Jun 2015 16:59:01 +0000 (18:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jul 2015 02:35:52 +0000 (19:35 -0700)
!x is more normal for kzalloc failure in the kernel.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
statement S1, S2;
@@

x = kzalloc(...);
if (
- x == NULL
+ !x
 ) S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/lclient/lcommon_cl.c

index e0c1ccafbd63562f2be3e7ae11b24995091fdc79..9053f811629874f72f479d20c630b6946a12f3f6 100644 (file)
@@ -203,7 +203,7 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
        int rc;
 
        vdv = kzalloc(sizeof(*vdv), GFP_NOFS);
-       if (vdv == NULL)
+       if (!vdv)
                return ERR_PTR(-ENOMEM);
 
        lud = &vdv->cdv_cl.cd_lu_dev;