From: Weitao Hou <houweitaoo@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
Weitao Hou <houweitaoo@gmail.com>
Subject: [PATCH] ext4: use rb_entry_safe() instead of open-coding it
Date: Thu, 25 Jul 2019 21:16:58 +0800 [thread overview]
Message-ID: <20190725131658.17187-1-houweitaoo@gmail.com> (raw)
use rb_entry_safe() to make it clean
Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
---
fs/ext4/extents_status.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index 7521de2dcf3a..08ce5ded3538 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -228,8 +228,7 @@ static struct extent_status *__es_tree_search(struct rb_root *root,
if (es && lblk > ext4_es_end(es)) {
node = rb_next(&es->rb_node);
- return node ? rb_entry(node, struct extent_status, rb_node) :
- NULL;
+ return rb_entry_safe(node, struct extent_status, rb_node);
}
return NULL;
--
2.18.0
next reply other threads:[~2019-07-25 13:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 13:16 Weitao Hou [this message]
2019-08-02 11:02 ` [PATCH] ext4: use rb_entry_safe() instead of open-coding it Jan Kara
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=20190725131658.17187-1-houweitaoo@gmail.com \
--to=houweitaoo@gmail.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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).