From: Nathan Chancellor <nathan@kernel.org>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
ntfs3@lists.linux.dev, llvm@lists.linux.dev,
patches@lists.linux.dev, linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH -next v2 2/2] fs/ntfs3: Eliminate unnecessary ternary operator in ntfs_d_compare()
Date: Tue, 4 Oct 2022 16:23:59 -0700 [thread overview]
Message-ID: <20221004232359.285685-2-nathan@kernel.org> (raw)
In-Reply-To: <20221004232359.285685-1-nathan@kernel.org>
'a == b ? 0 : 1' is logically equivalent to 'a != b'.
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
v2: New patch.
fs/ntfs3/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index 5d3a6ce3f05f..6b0d2c01d6ff 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -432,7 +432,7 @@ static int ntfs_d_compare(const struct dentry *dentry, unsigned int len1,
/* First try fast implementation. */
for (;;) {
if (!lm--)
- return len1 == len2 ? 0 : 1;
+ return len1 != len2;
if ((c1 = *n1++) == (c2 = *n2++))
continue;
--
2.37.3
next prev parent reply other threads:[~2022-10-04 23:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 23:23 [PATCH -next v2 1/2] fs/ntfs3: Don't use uni1 uninitialized in ntfs_d_compare() Nathan Chancellor
2022-10-04 23:23 ` Nathan Chancellor [this message]
2022-10-04 23:26 ` [PATCH -next v2 2/2] fs/ntfs3: Eliminate unnecessary ternary operator " Nick Desaulniers
2022-11-12 18:11 ` Konstantin Komarov
2022-10-21 17:10 ` [PATCH -next v2 1/2] fs/ntfs3: Don't use uni1 uninitialized " Nathan Chancellor
2022-10-26 16:56 ` Konstantin Komarov
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=20221004232359.285685-2-nathan@kernel.org \
--to=nathan@kernel.org \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=ntfs3@lists.linux.dev \
--cc=patches@lists.linux.dev \
--cc=trix@redhat.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).