!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>
if (lvb_len) {
lock->l_lvb_len = lvb_len;
lock->l_lvb_data = kzalloc(lvb_len, GFP_NOFS);
if (lvb_len) {
lock->l_lvb_len = lvb_len;
lock->l_lvb_data = kzalloc(lvb_len, GFP_NOFS);
- if (lock->l_lvb_data == NULL)
return 0;
arg = kzalloc(sizeof(*arg), GFP_NOFS);
return 0;
arg = kzalloc(sizeof(*arg), GFP_NOFS);
return -ENOMEM;
atomic_set(&arg->restart, 0);
return -ENOMEM;
atomic_set(&arg->restart, 0);
void *lvb_data;
lvb_data = kzalloc(lvb_len, GFP_NOFS);
void *lvb_data;
lvb_data = kzalloc(lvb_len, GFP_NOFS);
- if (lvb_data == NULL) {
LDLM_ERROR(lock, "No memory: %d.\n", lvb_len);
rc = -ENOMEM;
goto out;
LDLM_ERROR(lock, "No memory: %d.\n", lvb_len);
rc = -ENOMEM;
goto out;
struct ldlm_bl_work_item *blwi;
blwi = kzalloc(sizeof(*blwi), GFP_NOFS);
struct ldlm_bl_work_item *blwi;
blwi = kzalloc(sizeof(*blwi), GFP_NOFS);
return -ENOMEM;
init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
return -ENOMEM;
init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
return -EALREADY;
ldlm_state = kzalloc(sizeof(*ldlm_state), GFP_NOFS);
return -EALREADY;
ldlm_state = kzalloc(sizeof(*ldlm_state), GFP_NOFS);
- if (ldlm_state == NULL)
return -ENOMEM;
ldlm_kobj = kobject_create_and_add("ldlm", lustre_kobj);
return -ENOMEM;
ldlm_kobj = kobject_create_and_add("ldlm", lustre_kobj);
blp = kzalloc(sizeof(*blp), GFP_NOFS);
blp = kzalloc(sizeof(*blp), GFP_NOFS);
rc = -ENOMEM;
goto out;
}
rc = -ENOMEM;
goto out;
}
return -EALREADY;
ldlm_pools_thread = kzalloc(sizeof(*ldlm_pools_thread), GFP_NOFS);
return -EALREADY;
ldlm_pools_thread = kzalloc(sizeof(*ldlm_pools_thread), GFP_NOFS);
- if (ldlm_pools_thread == NULL)
+ if (!ldlm_pools_thread)
return -ENOMEM;
init_completion(&ldlm_pools_comp);
return -ENOMEM;
init_completion(&ldlm_pools_comp);