From: Shraddha Barke <shraddha.6596@gmail.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Julia Lawall <Julia.Lawall@lip6.fr>
Cc: HPDD-discuss@ml01.01.org, linux-kernel@vger.kernel.org,
Shraddha Barke <shraddha.6596@gmail.com>
Subject: [PATCH 08/16] Staging: lustre: libcfs: libcfs_mem.c: Remove explicit NULL comparison
Date: Fri, 11 Sep 2015 07:34:09 +0530 [thread overview]
Message-ID: <1441937051-2546-2-git-send-email-shraddha.6596@gmail.com> (raw)
In-Reply-To: <1441937051-2546-1-git-send-email-shraddha.6596@gmail.com>
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>
---
drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
index 1debdda..f4e08da 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_mem.c
@@ -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;
}
--
2.1.4
next prev parent reply other threads:[~2015-09-11 2:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 2:04 [PATCH 07/16] Staging: lustre: libcfs: libcfs_lock.c: Remove explicit NULL comparison Shraddha Barke
2015-09-11 2:04 ` Shraddha Barke [this message]
2015-09-11 2:04 ` [PATCH 09/16] Staging: lustre: obdclass: obd_config.c: " Shraddha Barke
2015-09-11 2:04 ` [PATCH 10/16] Staging: lustre: obdclass: genops.c: " Shraddha Barke
2015-09-11 2:51 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441937051-2546-2-git-send-email-shraddha.6596@gmail.com \
--to=shraddha.6596@gmail.com \
--cc=HPDD-discuss@ml01.01.org \
--cc=Julia.Lawall@lip6.fr \
--cc=andreas.dilger@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).