From: kernel test robot <lkp@intel.com>
To: Leon Romanovsky <leonro@nvidia.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [leon-rdma:dma-split-wip 25/26] drivers/nvme/host/pci.c:732:18: warning: result of comparison of constant 512 with expression of type 'u8' (aka 'unsigned char') is always false
Date: Thu, 12 Sep 2024 22:52:30 +0800 [thread overview]
Message-ID: <202409122256.Gjz9KnCP-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git dma-split-wip
head: 63cdbb87e1b08464705fa343b65e561eb3abd5f9
commit: dd0782c9fcb73487b60939a11f381411464f0572 [25/26] nvme-pci: use new dma API
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240912/202409122256.Gjz9KnCP-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240912/202409122256.Gjz9KnCP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409122256.Gjz9KnCP-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/nvme/host/pci.c:732:18: warning: result of comparison of constant 512 with expression of type 'u8' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
732 | WARN_ON(entries > 512);
| ~~~~~~~ ^ ~~~
include/asm-generic/bug.h:123:25: note: expanded from macro 'WARN_ON'
123 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
1 warning generated.
vim +732 drivers/nvme/host/pci.c
705
706 static blk_status_t nvme_pci_setup_pool(struct nvme_dev *dev,
707 struct request *req, bool is_sgl)
708 {
709 struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
710 struct dma_pool *pool;
711 size_t entry_sz;
712 dma_addr_t addr;
713 u8 entries;
714 void *list;
715
716 if (iod->nr_dmas <= 2)
717 /* Do nothing, we can use the inline PRP/SG list */
718 return BLK_STS_OK;
719
720 /* First DMA address goes to prp1 anyway */
721 entries = iod->nr_dmas - 1;
722 entry_sz = (is_sgl) ? sizeof(struct nvme_sgl_desc) : sizeof(__le64);
723 if (entries <= (256 / entry_sz)) {
724 pool = dev->prp_small_pool;
725 iod->nr_allocations = 0;
726 } else {
727 pool = dev->prp_page_pool;
728 iod->nr_allocations = 1;
729 }
730
731 /* TBD: allocate mulitple pools and chain them */
> 732 WARN_ON(entries > 512);
733
734 list = dma_pool_alloc(pool, GFP_ATOMIC, &addr);
735 if (!list) {
736 iod->nr_allocations = -1;
737 return BLK_STS_RESOURCE;
738 }
739
740 if (is_sgl)
741 iod->list[0].sg_list = list;
742 else
743 iod->list[0].prp_list = list;
744 iod->first_dma = addr;
745 return BLK_STS_OK;
746 }
747
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-09-12 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202409122256.Gjz9KnCP-lkp@intel.com \
--to=lkp@intel.com \
--cc=kch@nvidia.com \
--cc=leonro@nvidia.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
/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