All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [block:for-next 14/18] block/blk-merge.c:999:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B'
Date: Tue, 01 Sep 2020 23:39:43 +0300	[thread overview]
Message-ID: <20200901203943.GG8321@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3745 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git  for-next
head:   38f02fdbc7a5d5c4fc765e12541eab8b27b0eb91
commit: c7c06419eb01c4990598c960f337bd7c3d4fc377 [14/18] block: Add a new helper to attempt to merge a bio
compiler: sh4-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck warnings: (new ones prefixed by >>)

>> block/blk-merge.c:999:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B' [redundantCondition]
     if (!sched_allow_merge ||
                            ^
   block/blk-merge.c:1004:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B' [redundantCondition]
     if (!sched_allow_merge ||

# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=c7c06419eb01c4990598c960f337bd7c3d4fc377 
git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
git fetch --no-tags block for-next
git checkout c7c06419eb01c4990598c960f337bd7c3d4fc377
vim +999 block/blk-merge.c

c7c06419eb01c4 Baolin Wang 2020-08-28   988  static enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q,
c7c06419eb01c4 Baolin Wang 2020-08-28   989  						   struct request *rq,
c7c06419eb01c4 Baolin Wang 2020-08-28   990  						   struct bio *bio,
c7c06419eb01c4 Baolin Wang 2020-08-28   991  						   unsigned int nr_segs,
c7c06419eb01c4 Baolin Wang 2020-08-28   992  						   bool sched_allow_merge)
c7c06419eb01c4 Baolin Wang 2020-08-28   993  {
c7c06419eb01c4 Baolin Wang 2020-08-28   994  	if (!blk_rq_merge_ok(rq, bio))
c7c06419eb01c4 Baolin Wang 2020-08-28   995  		return BIO_MERGE_NONE;
c7c06419eb01c4 Baolin Wang 2020-08-28   996  
c7c06419eb01c4 Baolin Wang 2020-08-28   997  	switch (blk_try_merge(rq, bio)) {
c7c06419eb01c4 Baolin Wang 2020-08-28   998  	case ELEVATOR_BACK_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  @999  		if (!sched_allow_merge ||
c7c06419eb01c4 Baolin Wang 2020-08-28  1000  		    (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio)))
                                                             ^^^^^^^^^^^^^^^^^
Delete this duplicative condition?

c7c06419eb01c4 Baolin Wang 2020-08-28  1001  			return bio_attempt_back_merge(rq, bio, nr_segs);
c7c06419eb01c4 Baolin Wang 2020-08-28  1002  		break;
c7c06419eb01c4 Baolin Wang 2020-08-28  1003  	case ELEVATOR_FRONT_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  1004  		if (!sched_allow_merge ||
c7c06419eb01c4 Baolin Wang 2020-08-28  1005  		    (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio)))
                                                             ^^^^^^^^^^^^^^^^^
Same

c7c06419eb01c4 Baolin Wang 2020-08-28  1006  			return bio_attempt_front_merge(rq, bio, nr_segs);
c7c06419eb01c4 Baolin Wang 2020-08-28  1007  		break;
c7c06419eb01c4 Baolin Wang 2020-08-28  1008  	case ELEVATOR_DISCARD_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  1009  		return bio_attempt_discard_merge(q, rq, bio);
c7c06419eb01c4 Baolin Wang 2020-08-28  1010  	default:
c7c06419eb01c4 Baolin Wang 2020-08-28  1011  		return BIO_MERGE_NONE;
c7c06419eb01c4 Baolin Wang 2020-08-28  1012  	}
c7c06419eb01c4 Baolin Wang 2020-08-28  1013  
c7c06419eb01c4 Baolin Wang 2020-08-28  1014  	return BIO_MERGE_FAILED;
a7a10c146dc70e Baolin Wang 2020-08-28  1015  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [kbuild] [block:for-next 14/18] block/blk-merge.c:999:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B'
Date: Tue, 01 Sep 2020 23:39:43 +0300	[thread overview]
Message-ID: <20200901203943.GG8321@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 3745 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git  for-next
head:   38f02fdbc7a5d5c4fc765e12541eab8b27b0eb91
commit: c7c06419eb01c4990598c960f337bd7c3d4fc377 [14/18] block: Add a new helper to attempt to merge a bio
compiler: sh4-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

cppcheck warnings: (new ones prefixed by >>)

>> block/blk-merge.c:999:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B' [redundantCondition]
     if (!sched_allow_merge ||
                            ^
   block/blk-merge.c:1004:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B' [redundantCondition]
     if (!sched_allow_merge ||

# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=c7c06419eb01c4990598c960f337bd7c3d4fc377 
git remote add block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
git fetch --no-tags block for-next
git checkout c7c06419eb01c4990598c960f337bd7c3d4fc377
vim +999 block/blk-merge.c

c7c06419eb01c4 Baolin Wang 2020-08-28   988  static enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q,
c7c06419eb01c4 Baolin Wang 2020-08-28   989  						   struct request *rq,
c7c06419eb01c4 Baolin Wang 2020-08-28   990  						   struct bio *bio,
c7c06419eb01c4 Baolin Wang 2020-08-28   991  						   unsigned int nr_segs,
c7c06419eb01c4 Baolin Wang 2020-08-28   992  						   bool sched_allow_merge)
c7c06419eb01c4 Baolin Wang 2020-08-28   993  {
c7c06419eb01c4 Baolin Wang 2020-08-28   994  	if (!blk_rq_merge_ok(rq, bio))
c7c06419eb01c4 Baolin Wang 2020-08-28   995  		return BIO_MERGE_NONE;
c7c06419eb01c4 Baolin Wang 2020-08-28   996  
c7c06419eb01c4 Baolin Wang 2020-08-28   997  	switch (blk_try_merge(rq, bio)) {
c7c06419eb01c4 Baolin Wang 2020-08-28   998  	case ELEVATOR_BACK_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  @999  		if (!sched_allow_merge ||
c7c06419eb01c4 Baolin Wang 2020-08-28  1000  		    (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio)))
                                                             ^^^^^^^^^^^^^^^^^
Delete this duplicative condition?

c7c06419eb01c4 Baolin Wang 2020-08-28  1001  			return bio_attempt_back_merge(rq, bio, nr_segs);
c7c06419eb01c4 Baolin Wang 2020-08-28  1002  		break;
c7c06419eb01c4 Baolin Wang 2020-08-28  1003  	case ELEVATOR_FRONT_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  1004  		if (!sched_allow_merge ||
c7c06419eb01c4 Baolin Wang 2020-08-28  1005  		    (sched_allow_merge && blk_mq_sched_allow_merge(q, rq, bio)))
                                                             ^^^^^^^^^^^^^^^^^
Same

c7c06419eb01c4 Baolin Wang 2020-08-28  1006  			return bio_attempt_front_merge(rq, bio, nr_segs);
c7c06419eb01c4 Baolin Wang 2020-08-28  1007  		break;
c7c06419eb01c4 Baolin Wang 2020-08-28  1008  	case ELEVATOR_DISCARD_MERGE:
c7c06419eb01c4 Baolin Wang 2020-08-28  1009  		return bio_attempt_discard_merge(q, rq, bio);
c7c06419eb01c4 Baolin Wang 2020-08-28  1010  	default:
c7c06419eb01c4 Baolin Wang 2020-08-28  1011  		return BIO_MERGE_NONE;
c7c06419eb01c4 Baolin Wang 2020-08-28  1012  	}
c7c06419eb01c4 Baolin Wang 2020-08-28  1013  
c7c06419eb01c4 Baolin Wang 2020-08-28  1014  	return BIO_MERGE_FAILED;
a7a10c146dc70e Baolin Wang 2020-08-28  1015  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

             reply	other threads:[~2020-09-01 20:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 20:39 Dan Carpenter [this message]
2020-09-01 20:39 ` [kbuild] [block:for-next 14/18] block/blk-merge.c:999:26: warning: Redundant condition: sched_allow_merge. '!A || (A && B)' is equivalent to '!A || B' Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-09-01 19:36 kernel test robot

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=20200901203943.GG8321@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.