oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Cc: oe-kbuild-all@lists.linux.dev, Felix Fietkau <nbd@nbd.name>
Subject: [nbd168-wireless:mt76 60/62] drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:1285:19: sparse: sparse: cast to restricted __le16
Date: Mon, 11 Dec 2023 21:22:49 +0800	[thread overview]
Message-ID: <202312112104.Zkc3QUHr-lkp@intel.com> (raw)

tree:   https://github.com/nbd168/wireless mt76
head:   0318b308805ea665679297c3f24b243c1b39b292
commit: f7c70874120cb7daafe0754f270d8313cb9bb208 [60/62] wifi: mt76: mt7921: fix country count limitation for CLC
config: csky-randconfig-r113-20231211 (https://download.01.org/0day-ci/archive/20231211/202312112104.Zkc3QUHr-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231211/202312112104.Zkc3QUHr-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/202312112104.Zkc3QUHr-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:1285:19: sparse: sparse: cast to restricted __le16
>> drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:1285:19: sparse: sparse: cast from restricted __le32

vim +1285 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c

  1242	
  1243	static
  1244	int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
  1245				 enum environment_cap env_cap,
  1246				 struct mt7921_clc *clc,
  1247				 u8 idx)
  1248	{
  1249	#define CLC_CAP_EVT_EN BIT(0)
  1250	#define CLC_CAP_DTS_EN BIT(1)
  1251		struct sk_buff *skb, *ret_skb = NULL;
  1252		struct {
  1253			u8 ver;
  1254			u8 pad0;
  1255			__le16 len;
  1256			u8 idx;
  1257			u8 env;
  1258			u8 acpi_conf;
  1259			u8 cap;
  1260			u8 alpha2[2];
  1261			u8 type[2];
  1262			u8 env_6g;
  1263			u8 mtcl_conf;
  1264			u8 rsvd[62];
  1265		} __packed req = {
  1266			.ver = 1,
  1267			.idx = idx,
  1268			.env = env_cap,
  1269			.env_6g = dev->phy.power_type,
  1270			.acpi_conf = mt792x_acpi_get_flags(&dev->phy),
  1271			.mtcl_conf = mt792x_acpi_get_mtcl_conf(&dev->phy, alpha2),
  1272		};
  1273		int ret, valid_cnt = 0;
  1274		u16 buf_len = 0;
  1275		u8 *pos;
  1276	
  1277		if (!clc)
  1278			return 0;
  1279	
  1280		if (dev->phy.chip_cap & MT792x_CHIP_CAP_CLC_EVT_EN)
  1281			req.cap |= CLC_CAP_EVT_EN;
  1282		if (mt76_find_power_limits_node(&dev->mt76))
  1283			req.cap |= CLC_CAP_DTS_EN;
  1284	
> 1285		buf_len = le16_to_cpu(clc->len) - sizeof(*clc);
  1286		pos = clc->data;
  1287		while (buf_len > 16) {
  1288			struct mt7921_clc_rule *rule = (struct mt7921_clc_rule *)pos;
  1289			u16 len = le16_to_cpu(rule->len);
  1290			u16 offset = len + sizeof(*rule);
  1291	
  1292			pos += offset;
  1293			buf_len -= offset;
  1294			if (rule->alpha2[0] != alpha2[0] ||
  1295			    rule->alpha2[1] != alpha2[1])
  1296				continue;
  1297	
  1298			memcpy(req.alpha2, rule->alpha2, 2);
  1299			memcpy(req.type, rule->type, 2);
  1300	
  1301			req.len = cpu_to_le16(sizeof(req) + len);
  1302			skb = __mt76_mcu_msg_alloc(&dev->mt76, &req,
  1303						   le16_to_cpu(req.len),
  1304						   sizeof(req), GFP_KERNEL);
  1305			if (!skb)
  1306				return -ENOMEM;
  1307			skb_put_data(skb, rule->data, len);
  1308	
  1309			ret = mt76_mcu_skb_send_and_get_msg(&dev->mt76, skb,
  1310							    MCU_CE_CMD(SET_CLC),
  1311							    !!(req.cap & CLC_CAP_EVT_EN),
  1312							    &ret_skb);
  1313			if (ret < 0)
  1314				return ret;
  1315	
  1316			if (ret_skb) {
  1317				struct mt7921_clc_info_tlv *info;
  1318	
  1319				info = (struct mt7921_clc_info_tlv *)(ret_skb->data + 4);
  1320				dev->phy.clc_chan_conf = info->chan_conf;
  1321				dev_kfree_skb(ret_skb);
  1322			}
  1323	
  1324			valid_cnt++;
  1325		}
  1326	
  1327		if (!valid_cnt)
  1328			return -ENOENT;
  1329	
  1330		return 0;
  1331	}
  1332	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2023-12-11 13:23 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=202312112104.Zkc3QUHr-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=mingyen.hsieh@mediatek.com \
    --cc=nbd@nbd.name \
    --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;
as well as URLs for NNTP newsgroup(s).