mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse: restricted __le16 degrades to integer
@ 2024-09-07 21:49 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-09-07 21:49 UTC (permalink / raw)
  To: Chengchang Tang
  Cc: oe-kbuild-all, linux-kernel, Leon Romanovsky, Junxian Huang

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b31c4492884252a8360f312a0ac2049349ddf603
commit: 5a87279591a15f952043209d17429fadab278d47 RDMA/hns: Support hns HW stats
date:   1 year, 1 month ago
config: sparc64-randconfig-r111-20240907 (https://download.01.org/0day-ci/archive/20240908/202409080508.g4mNSLwy-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240908/202409080508.g4mNSLwy-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/202409080508.g4mNSLwy-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:342:9: sparse: sparse: dubious: x & !y
>> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse: restricted __le16 degrades to integer
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:486:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y
   drivers/infiniband/hw/hns/hns_roce_hw_v2.c:488:9: sparse: sparse: dubious: x & !y

vim +1651 drivers/infiniband/hw/hns/hns_roce_hw_v2.c

  1615	
  1616	static int hns_roce_hw_v2_query_counter(struct hns_roce_dev *hr_dev,
  1617						u64 *stats, u32 port, int *num_counters)
  1618	{
  1619	#define CNT_PER_DESC 3
  1620		struct hns_roce_cmq_desc *desc;
  1621		int bd_idx, cnt_idx;
  1622		__le64 *cnt_data;
  1623		int desc_num;
  1624		int ret;
  1625		int i;
  1626	
  1627		if (port > hr_dev->caps.num_ports)
  1628			return -EINVAL;
  1629	
  1630		desc_num = DIV_ROUND_UP(HNS_ROCE_HW_CNT_TOTAL, CNT_PER_DESC);
  1631		desc = kcalloc(desc_num, sizeof(*desc), GFP_KERNEL);
  1632		if (!desc)
  1633			return -ENOMEM;
  1634	
  1635		for (i = 0; i < desc_num; i++) {
  1636			hns_roce_cmq_setup_basic_desc(&desc[i],
  1637						      HNS_ROCE_OPC_QUERY_COUNTER, true);
  1638			if (i != desc_num - 1)
  1639				desc[i].flag |= cpu_to_le16(HNS_ROCE_CMD_FLAG_NEXT);
  1640		}
  1641	
  1642		ret = hns_roce_cmq_send(hr_dev, desc, desc_num);
  1643		if (ret) {
  1644			ibdev_err(&hr_dev->ib_dev,
  1645				  "failed to get counter, ret = %d.\n", ret);
  1646			goto err_out;
  1647		}
  1648	
  1649		for (i = 0; i < HNS_ROCE_HW_CNT_TOTAL && i < *num_counters; i++) {
  1650			bd_idx = i / CNT_PER_DESC;
> 1651			if (!(desc[bd_idx].flag & HNS_ROCE_CMD_FLAG_NEXT) &&
  1652			    bd_idx != HNS_ROCE_HW_CNT_TOTAL / CNT_PER_DESC)
  1653				break;
  1654	
  1655			cnt_data = (__le64 *)&desc[bd_idx].data[0];
  1656			cnt_idx = i % CNT_PER_DESC;
  1657			stats[i] = le64_to_cpu(cnt_data[cnt_idx]);
  1658		}
  1659		*num_counters = i;
  1660	
  1661	err_out:
  1662		kfree(desc);
  1663		return ret;
  1664	}
  1665	

-- 
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-07 21:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-07 21:49 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse: restricted __le16 degrades to integer 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

Powered by JetHome