mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
Staging: lustre: libcfs: libcfs_mem.c: Remove explicit NULL comparison
Remove explicit NULL comparison and write it in its simpler form. Replacement done with coccinelle: @replace_rule@ expression e; @@ -e == NULL + !e Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0ecacb4e43
commit
fdf21a324c
@@ -84,7 +84,7 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int size)
|
||||
count = cfs_cpt_number(cptab);
|
||||
|
||||
LIBCFS_ALLOC(arr, offsetof(struct cfs_var_array, va_ptrs[count]));
|
||||
if (arr == NULL)
|
||||
if (!arr)
|
||||
return NULL;
|
||||
|
||||
arr->va_size = size = L1_CACHE_ALIGN(size);
|
||||
@@ -93,7 +93,7 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int size)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
LIBCFS_CPT_ALLOC(arr->va_ptrs[i], cptab, i, size);
|
||||
if (arr->va_ptrs[i] == NULL) {
|
||||
if (!arr->va_ptrs[i]) {
|
||||
cfs_percpt_free((void *)&arr->va_ptrs[0]);
|
||||
return NULL;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ cfs_array_free(void *vars)
|
||||
arr = container_of(vars, struct cfs_var_array, va_ptrs[0]);
|
||||
|
||||
for (i = 0; i < arr->va_count; i++) {
|
||||
if (arr->va_ptrs[i] == NULL)
|
||||
if (!arr->va_ptrs[i])
|
||||
continue;
|
||||
|
||||
LIBCFS_FREE(arr->va_ptrs[i], arr->va_size);
|
||||
@@ -182,7 +182,7 @@ cfs_array_alloc(int count, unsigned int size)
|
||||
int i;
|
||||
|
||||
LIBCFS_ALLOC(arr, offsetof(struct cfs_var_array, va_ptrs[count]));
|
||||
if (arr == NULL)
|
||||
if (!arr)
|
||||
return NULL;
|
||||
|
||||
arr->va_count = count;
|
||||
@@ -191,7 +191,7 @@ cfs_array_alloc(int count, unsigned int size)
|
||||
for (i = 0; i < count; i++) {
|
||||
LIBCFS_ALLOC(arr->va_ptrs[i], size);
|
||||
|
||||
if (arr->va_ptrs[i] == NULL) {
|
||||
if (!arr->va_ptrs[i]) {
|
||||
cfs_array_free((void *)&arr->va_ptrs[0]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user