[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220712152318.2649819-1-williamsukatube@163.com>
Date: Tue, 12 Jul 2022 23:23:18 +0800
From: williamsukatube@....com
To: linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: miklos@...redi.hu, William Dean <williamsukatube@...il.com>,
Hacash Robot <hacashRobot@...tino.com>
Subject: [PATCH -next] ovl: clean up comparsions to NULL
From: William Dean <williamsukatube@...il.com>
Clean up comparsions to NULL, simplify as follows:
if (x == NULL) -> if (!x)
Reported-by: Hacash Robot <hacashRobot@...tino.com>
Signed-off-by: William Dean <williamsukatube@...il.com>
---
fs/overlayfs/readdir.c | 6 +++---
fs/overlayfs/super.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 78f62cc1797b..953ff22d825c 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -182,7 +182,7 @@ static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd,
return 0;
p = ovl_cache_entry_new(rdd, name, len, ino, d_type);
- if (p == NULL) {
+ if (!p) {
rdd->err = -ENOMEM;
return -ENOMEM;
}
@@ -205,7 +205,7 @@ static int ovl_fill_lowest(struct ovl_readdir_data *rdd,
list_move_tail(&p->l_node, &rdd->middle);
} else {
p = ovl_cache_entry_new(rdd, name, namelen, ino, d_type);
- if (p == NULL)
+ if (!p)
rdd->err = -ENOMEM;
else
list_add_tail(&p->l_node, &rdd->middle);
@@ -538,7 +538,7 @@ static int ovl_fill_plain(struct dir_context *ctx, const char *name,
rdd->count++;
p = ovl_cache_entry_new(rdd, name, namelen, ino, d_type);
- if (p == NULL) {
+ if (!p) {
rdd->err = -ENOMEM;
return -ENOMEM;
}
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index e0a2e0468ee7..a474cb8040b2 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -468,7 +468,7 @@ static char *ovl_next_opt(char **s)
char *sbegin = *s;
char *p;
- if (sbegin == NULL)
+ if (!sbegin)
return NULL;
for (p = sbegin; *p; p++) {
@@ -2186,7 +2186,7 @@ static int __init ovl_init(void)
(SLAB_RECLAIM_ACCOUNT|
SLAB_MEM_SPREAD|SLAB_ACCOUNT),
ovl_inode_init_once);
- if (ovl_inode_cachep == NULL)
+ if (!ovl_inode_cachep)
return -ENOMEM;
err = ovl_aio_request_cache_init();
--
2.25.1
Powered by blists - more mailing lists