mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: agk@redhat.com, snitzer@kernel.org
Cc: ndesaulniers@google.com, trix@redhat.com,
	sweettea-kernel@dorminy.me, mpatocka@redhat.com,
	dm-devel@redhat.com, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, patches@lists.linux.dev,
	Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] dm flakey: Fix clang -Wparentheses-equality in flakey_map()
Date: Thu, 02 Feb 2023 09:58:18 -0700	[thread overview]
Message-ID: <20230202-dm-parenthesis-warning-v1-1-ebdee213eeb9@kernel.org> (raw)

Clang warns:

  ../drivers/md/dm-flakey.c:369:28: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
                          if ((fc->corrupt_bio_rw == WRITE)) {
                               ~~~~~~~~~~~~~~~~~~~^~~~~~~~
  ../drivers/md/dm-flakey.c:369:28: note: remove extraneous parentheses around the comparison to silence this warning
                          if ((fc->corrupt_bio_rw == WRITE)) {
                              ~                   ^       ~
  ../drivers/md/dm-flakey.c:369:28: note: use '=' to turn this equality comparison into an assignment
                          if ((fc->corrupt_bio_rw == WRITE)) {
                                                  ^~
                                                  =
  1 error generated.

GCC only warns when one set of parentheses are used for assignment
expressions, whereas clang additionally warns when two sets of
parentheses are used for equality comparisons. Remove the extra set of
parentheses to silence the warning as it suggests, as this is obviously
supposed to be an equality comparison.

Fixes: 0e766389cedc ("dm flakey: fix logic when corrupting a bio")
Link: https://github.com/ClangBuiltLinux/linux/issues/1798
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
I do not mind this change being squashed with the offending commit, as I
noticed it was Cc'd for stable, which would minimize the chance for
breakage.
---
 drivers/md/dm-flakey.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index 08f9aa476d97..335684a1aeaa 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -366,7 +366,7 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)
 		 * Corrupt matching writes.
 		 */
 		if (fc->corrupt_bio_byte) {
-			if ((fc->corrupt_bio_rw == WRITE)) {
+			if (fc->corrupt_bio_rw == WRITE) {
 				if (all_corrupt_bio_flags_match(bio, fc))
 					corrupt_bio_data(bio, fc);
 			}

---
base-commit: 6f30cc248507ee96c22ff4c3cbc86099ff12b7a9
change-id: 20230202-dm-parenthesis-warning-6139f4b5020b

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


             reply	other threads:[~2023-02-02 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 16:58 Nathan Chancellor [this message]
2023-02-02 19:00 ` Nick Desaulniers

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=20230202-dm-parenthesis-warning-v1-1-ebdee213eeb9@kernel.org \
    --to=nathan@kernel.org \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mpatocka@redhat.com \
    --cc=ndesaulniers@google.com \
    --cc=patches@lists.linux.dev \
    --cc=snitzer@kernel.org \
    --cc=sweettea-kernel@dorminy.me \
    --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

all inboxes | Powered by JetHome®