mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Chengchang Tang <tangchengchang@huawei.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Leon Romanovsky <leon@kernel.org>,
	Junxian Huang <huangjunxian6@hisilicon.com>
Subject: drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1651:35: sparse: sparse: restricted __le16 degrades to integer
Date: Sun, 8 Sep 2024 05:49:13 +0800	[thread overview]
Message-ID: <202409080508.g4mNSLwy-lkp@intel.com> (raw)

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

                 reply	other threads:[~2024-09-07 21:49 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=202409080508.g4mNSLwy-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=huangjunxian6@hisilicon.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tangchengchang@huawei.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

Powered by JetHome