Commit 6c7c6553 authored by Julia Lawall's avatar Julia Lawall Committed by Greg Kroah-Hartman

staging: lustre: fid: 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/)

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

x = kzalloc(...);
if (
- x == NULL
+ !x
 ) S1 else S2
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6fdb302c
...@@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *obd, ...@@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *obd,
int rc; int rc;
cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS); cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS);
if (cli->cl_seq == NULL) if (!cli->cl_seq)
return -ENOMEM; return -ENOMEM;
prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS); prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS);
if (prefix == NULL) { if (!prefix) {
rc = -ENOMEM; rc = -ENOMEM;
goto out_free_seq; goto out_free_seq;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment