Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [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
@ 2024-09-12 14:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-09-12 14:52 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: llvm, oe-kbuild-all, Chaitanya Kulkarni

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-12 14:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-12 14:52 [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 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox