From: Aaron Strahlberger <aaron.strahlberger@posteo.de>
To: Gao Xiang <gaoxiang25@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Chao Yu <yuchao0@huawei.com>,
linux-erofs@lists.ozlabs.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, linux-kernel@i4.cs.fau.de,
Aaron Strahlberger <aaron.strahlberger@posteo.de>,
Julius Wiedmann <julius.wiedmann@fau.de>,
Dominik Huber <domi250@gmx.de>
Subject: [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues.
Date: Tue, 11 Dec 2018 11:54:40 +0100 [thread overview]
Message-ID: <20181211105443.21826-3-aaron.strahlberger@posteo.de> (raw)
In-Reply-To: <20181211105443.21826-1-aaron.strahlberger@posteo.de>
Fix of 7 `CHECK: Comparison to NULL could be written ...` issues.
Signed-off-by: Aaron Strahlberger <aaron.strahlberger@posteo.de>
Signed-off-by: Julius Wiedmann <julius.wiedmann@fau.de>
Signed-off-by: Dominik Huber <domi250@gmx.de>
---
drivers/staging/erofs/data.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/erofs/data.c b/drivers/staging/erofs/data.c
index d1c0a7be6eb8..5a55f0bfdfbb 100644
--- a/drivers/staging/erofs/data.c
+++ b/drivers/staging/erofs/data.c
@@ -53,7 +53,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
repeat:
page = find_or_create_page(mapping, blkaddr, gfp);
- if (unlikely(page == NULL)) {
+ if (unlikely(!page)) {
DBG_BUGON(nofail);
return ERR_PTR(-ENOMEM);
}
@@ -167,16 +167,17 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
#ifdef CONFIG_EROFS_FS_ZIP
extern int z_erofs_map_blocks_iter(struct inode *,
- struct erofs_map_blocks *, struct page **, int);
+ struct erofs_map_blocks *,
+ struct page **, int);
#endif
int erofs_map_blocks_iter(struct inode *inode,
- struct erofs_map_blocks *map,
- struct page **mpage_ret, int flags)
+ struct erofs_map_blocks *map,
+ struct page **mpage_ret, int flags)
{
/* by default, reading raw data never use erofs_map_blocks_iter */
if (unlikely(!is_inode_layout_compression(inode))) {
- if (*mpage_ret != NULL)
+ if (*mpage_ret)
put_page(*mpage_ret);
*mpage_ret = NULL;
@@ -231,15 +232,15 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
}
/* note that for readpage case, bio also equals to NULL */
- if (bio != NULL &&
- /* not continuous */
- *last_block + 1 != current_block) {
+ if (bio &&
+ /* not continuous */
+ *last_block + 1 != current_block) {
submit_bio_retry:
__submit_bio(bio, REQ_OP_READ, 0);
bio = NULL;
}
- if (bio == NULL) {
+ if (!bio) {
struct erofs_map_blocks map = {
.m_la = blknr_to_addr(current_block),
};
@@ -341,7 +342,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
unlock_page(page);
/* if updated manually, continuous pages has a gap */
- if (bio != NULL)
+ if (bio)
submit_bio_out:
__submit_bio(bio, REQ_OP_READ, 0);
@@ -407,7 +408,7 @@ static int erofs_raw_access_readpages(struct file *filp,
DBG_BUGON(!list_empty(pages));
/* the rare case (end in gaps) */
- if (unlikely(bio != NULL))
+ if (unlikely(bio))
__submit_bio(bio, REQ_OP_READ, 0);
return 0;
}
--
2.19.2
next prev parent reply other threads:[~2018-12-11 10:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 9:06 [PATCH] drivers: staging: erofs: Fix styling issues Aaron Strahlberger
2018-12-11 9:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 0/5] " Aaron Strahlberger
2018-12-11 10:54 ` [PATCH 1/5] drivers: staging: erofs: Fix alignment Aaron Strahlberger
2018-12-11 11:19 ` Gao Xiang
2018-12-11 13:00 ` Dan Carpenter
2018-12-11 10:54 ` Aaron Strahlberger [this message]
2018-12-11 11:22 ` [PATCH 2/5] drivers: staging: erofs: Fix comparison to NULL issues Gao Xiang
2018-12-11 10:54 ` [PATCH 3/5] drivers: staging: erofs: Fix spelling issue Aaron Strahlberger
2018-12-11 11:27 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 4/5] drivers: staging: erofs: Fix parentheses error in macro Aaron Strahlberger
2018-12-11 11:06 ` Gao Xiang
2018-12-11 15:48 ` Joe Perches
2018-12-11 17:05 ` Gao Xiang
2018-12-12 12:02 ` [PATCH v2] staging:erofs: Remove __EROFS_BIT macro Aaron Strahlberger
2018-12-12 12:18 ` Gao Xiang
2018-12-11 10:54 ` [PATCH 5/5] drivers: staging: erofs: Add blank line after function Aaron Strahlberger
2018-12-12 12:00 ` [PATCH v2] staging:erofs: Fix alignment issues Aaron Strahlberger
2018-12-12 12:11 ` Gao Xiang
2018-12-12 12:29 ` Gao Xiang
2018-12-11 12:51 ` [PATCH] drivers: staging: erofs: Fix styling issues Dan Carpenter
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=20181211105443.21826-3-aaron.strahlberger@posteo.de \
--to=aaron.strahlberger@posteo.de \
--cc=devel@driverdev.osuosl.org \
--cc=domi250@gmx.de \
--cc=gaoxiang25@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=julius.wiedmann@fau.de \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@i4.cs.fau.de \
--cc=linux-kernel@vger.kernel.org \
--cc=yuchao0@huawei.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).