[PATCH 3/3] jffs2: Adjust a null pointer check in two functions
From: SF Markus Elfring
Date: Fri Aug 18 2017 - 15:09:37 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Aug 2017 20:40:35 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script âcheckpatch.plâ pointed information out like the following.
Comparison to NULL could be written â
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
fs/jffs2/nodemgmt.c | 3 +--
fs/jffs2/security.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index a7bbe879cfc3..d5346ba782f7 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -242,8 +242,7 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
static void jffs2_close_nextblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
{
-
- if (c->nextblock == NULL) {
+ if (!c->nextblock) {
jffs2_dbg(1, "%s(): Erase block at 0x%08x has already been placed in a list\n",
__func__, jeb->offset);
return;
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index c2332e30f218..9859b522721f 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -29,7 +29,7 @@ static int jffs2_initxattrs(struct inode *inode,
const struct xattr *xattr;
int err = 0;
- for (xattr = xattr_array; xattr->name != NULL; xattr++) {
+ for (xattr = xattr_array; xattr->name; xattr++) {
err = do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY,
xattr->name, xattr->value,
xattr->value_len, 0);
--
2.14.0