drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: sparse: sparse: incorrect type in assignment (different base types)
From: kernel test robot
Date: Sat Nov 20 2021 - 03:05:00 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 803f4e1eab7a8938ba3a3c30dd4eb5e9eeef5e63 asm-generic: simplify asm/unaligned.h
date: 6 months ago
config: sparc64-randconfig-s031-20211116 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=803f4e1eab7a8938ba3a3c30dd4eb5e9eeef5e63
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 803f4e1eab7a8938ba3a3c30dd4eb5e9eeef5e63
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 x @@ got unsigned short [usertype] @@
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: sparse: expected restricted __le16 x
drivers/net/wireless/ath/ath6kl/htc_pipe.c:241:17: sparse: got unsigned short [usertype]
--
>> drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 x @@ got unsigned short [usertype] @@
drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: sparse: expected restricted __le16 x
drivers/net/wireless/ath/ath6kl/htc_mbox.c:368:9: sparse: got unsigned short [usertype]
--
>> drivers/hid/hid-uclogic-rdesc.c:854:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected signed int x @@ got restricted __le32 [usertype] @@
drivers/hid/hid-uclogic-rdesc.c:854:25: sparse: expected signed int x
drivers/hid/hid-uclogic-rdesc.c:854:25: sparse: got restricted __le32 [usertype]
vim +241 drivers/net/wireless/ath/ath6kl/htc_pipe.c
636f828844fad9 Kalle Valo 2012-03-25 202
636f828844fad9 Kalle Valo 2012-03-25 203 static int htc_issue_packets(struct htc_target *target,
636f828844fad9 Kalle Valo 2012-03-25 204 struct htc_endpoint *ep,
636f828844fad9 Kalle Valo 2012-03-25 205 struct list_head *pkt_queue)
636f828844fad9 Kalle Valo 2012-03-25 206 {
636f828844fad9 Kalle Valo 2012-03-25 207 int status = 0;
636f828844fad9 Kalle Valo 2012-03-25 208 u16 payload_len;
636f828844fad9 Kalle Valo 2012-03-25 209 struct sk_buff *skb;
636f828844fad9 Kalle Valo 2012-03-25 210 struct htc_frame_hdr *htc_hdr;
636f828844fad9 Kalle Valo 2012-03-25 211 struct htc_packet *packet;
636f828844fad9 Kalle Valo 2012-03-25 212
636f828844fad9 Kalle Valo 2012-03-25 213 ath6kl_dbg(ATH6KL_DBG_HTC,
636f828844fad9 Kalle Valo 2012-03-25 214 "%s: queue: 0x%p, pkts %d\n", __func__,
636f828844fad9 Kalle Valo 2012-03-25 215 pkt_queue, get_queue_depth(pkt_queue));
636f828844fad9 Kalle Valo 2012-03-25 216
636f828844fad9 Kalle Valo 2012-03-25 217 while (!list_empty(pkt_queue)) {
636f828844fad9 Kalle Valo 2012-03-25 218 packet = list_first_entry(pkt_queue, struct htc_packet, list);
636f828844fad9 Kalle Valo 2012-03-25 219 list_del(&packet->list);
636f828844fad9 Kalle Valo 2012-03-25 220
636f828844fad9 Kalle Valo 2012-03-25 221 skb = packet->skb;
636f828844fad9 Kalle Valo 2012-03-25 222 if (!skb) {
636f828844fad9 Kalle Valo 2012-03-25 223 WARN_ON_ONCE(1);
636f828844fad9 Kalle Valo 2012-03-25 224 status = -EINVAL;
636f828844fad9 Kalle Valo 2012-03-25 225 break;
636f828844fad9 Kalle Valo 2012-03-25 226 }
636f828844fad9 Kalle Valo 2012-03-25 227
636f828844fad9 Kalle Valo 2012-03-25 228 payload_len = packet->act_len;
636f828844fad9 Kalle Valo 2012-03-25 229
636f828844fad9 Kalle Valo 2012-03-25 230 /* setup HTC frame header */
d58ff35122847a Johannes Berg 2017-06-16 231 htc_hdr = skb_push(skb, sizeof(*htc_hdr));
636f828844fad9 Kalle Valo 2012-03-25 232 if (!htc_hdr) {
636f828844fad9 Kalle Valo 2012-03-25 233 WARN_ON_ONCE(1);
636f828844fad9 Kalle Valo 2012-03-25 234 status = -EINVAL;
636f828844fad9 Kalle Valo 2012-03-25 235 break;
636f828844fad9 Kalle Valo 2012-03-25 236 }
636f828844fad9 Kalle Valo 2012-03-25 237
636f828844fad9 Kalle Valo 2012-03-25 238 packet->info.tx.flags |= HTC_FLAGS_TX_FIXUP_NETBUF;
636f828844fad9 Kalle Valo 2012-03-25 239
636f828844fad9 Kalle Valo 2012-03-25 240 /* Endianess? */
636f828844fad9 Kalle Valo 2012-03-25 @241 put_unaligned((u16) payload_len, &htc_hdr->payld_len);
636f828844fad9 Kalle Valo 2012-03-25 242 htc_hdr->flags = packet->info.tx.flags;
636f828844fad9 Kalle Valo 2012-03-25 243 htc_hdr->eid = (u8) packet->endpoint;
636f828844fad9 Kalle Valo 2012-03-25 244 htc_hdr->ctrl[0] = 0;
636f828844fad9 Kalle Valo 2012-03-25 245 htc_hdr->ctrl[1] = (u8) packet->info.tx.seqno;
636f828844fad9 Kalle Valo 2012-03-25 246
636f828844fad9 Kalle Valo 2012-03-25 247 spin_lock_bh(&target->tx_lock);
636f828844fad9 Kalle Valo 2012-03-25 248
636f828844fad9 Kalle Valo 2012-03-25 249 /* store in look up queue to match completions */
636f828844fad9 Kalle Valo 2012-03-25 250 list_add_tail(&packet->list, &ep->pipe.tx_lookup_queue);
636f828844fad9 Kalle Valo 2012-03-25 251 ep->ep_st.tx_issued += 1;
636f828844fad9 Kalle Valo 2012-03-25 252 spin_unlock_bh(&target->tx_lock);
636f828844fad9 Kalle Valo 2012-03-25 253
636f828844fad9 Kalle Valo 2012-03-25 254 status = ath6kl_hif_pipe_send(target->dev->ar,
636f828844fad9 Kalle Valo 2012-03-25 255 ep->pipe.pipeid_ul, NULL, skb);
636f828844fad9 Kalle Valo 2012-03-25 256
636f828844fad9 Kalle Valo 2012-03-25 257 if (status != 0) {
636f828844fad9 Kalle Valo 2012-03-25 258 if (status != -ENOMEM) {
636f828844fad9 Kalle Valo 2012-03-25 259 /* TODO: if more than 1 endpoint maps to the
636f828844fad9 Kalle Valo 2012-03-25 260 * same PipeID, it is possible to run out of
636f828844fad9 Kalle Valo 2012-03-25 261 * resources in the HIF layer.
636f828844fad9 Kalle Valo 2012-03-25 262 * Don't emit the error
636f828844fad9 Kalle Valo 2012-03-25 263 */
636f828844fad9 Kalle Valo 2012-03-25 264 ath6kl_dbg(ATH6KL_DBG_HTC,
636f828844fad9 Kalle Valo 2012-03-25 265 "%s: failed status:%d\n",
636f828844fad9 Kalle Valo 2012-03-25 266 __func__, status);
636f828844fad9 Kalle Valo 2012-03-25 267 }
636f828844fad9 Kalle Valo 2012-03-25 268 spin_lock_bh(&target->tx_lock);
636f828844fad9 Kalle Valo 2012-03-25 269 list_del(&packet->list);
636f828844fad9 Kalle Valo 2012-03-25 270
636f828844fad9 Kalle Valo 2012-03-25 271 /* reclaim credits */
636f828844fad9 Kalle Valo 2012-03-25 272 ep->cred_dist.credits += packet->info.tx.cred_used;
636f828844fad9 Kalle Valo 2012-03-25 273 spin_unlock_bh(&target->tx_lock);
636f828844fad9 Kalle Valo 2012-03-25 274
636f828844fad9 Kalle Valo 2012-03-25 275 /* put it back into the callers queue */
636f828844fad9 Kalle Valo 2012-03-25 276 list_add(&packet->list, pkt_queue);
636f828844fad9 Kalle Valo 2012-03-25 277 break;
636f828844fad9 Kalle Valo 2012-03-25 278 }
636f828844fad9 Kalle Valo 2012-03-25 279 }
636f828844fad9 Kalle Valo 2012-03-25 280
636f828844fad9 Kalle Valo 2012-03-25 281 if (status != 0) {
636f828844fad9 Kalle Valo 2012-03-25 282 while (!list_empty(pkt_queue)) {
636f828844fad9 Kalle Valo 2012-03-25 283 if (status != -ENOMEM) {
636f828844fad9 Kalle Valo 2012-03-25 284 ath6kl_dbg(ATH6KL_DBG_HTC,
636f828844fad9 Kalle Valo 2012-03-25 285 "%s: failed pkt:0x%p status:%d\n",
636f828844fad9 Kalle Valo 2012-03-25 286 __func__, packet, status);
636f828844fad9 Kalle Valo 2012-03-25 287 }
636f828844fad9 Kalle Valo 2012-03-25 288
636f828844fad9 Kalle Valo 2012-03-25 289 packet = list_first_entry(pkt_queue,
636f828844fad9 Kalle Valo 2012-03-25 290 struct htc_packet, list);
636f828844fad9 Kalle Valo 2012-03-25 291 list_del(&packet->list);
636f828844fad9 Kalle Valo 2012-03-25 292 packet->status = status;
636f828844fad9 Kalle Valo 2012-03-25 293 send_packet_completion(target, packet);
636f828844fad9 Kalle Valo 2012-03-25 294 }
636f828844fad9 Kalle Valo 2012-03-25 295 }
636f828844fad9 Kalle Valo 2012-03-25 296
636f828844fad9 Kalle Valo 2012-03-25 297 return status;
636f828844fad9 Kalle Valo 2012-03-25 298 }
636f828844fad9 Kalle Valo 2012-03-25 299
:::::: The code at line 241 was first introduced by commit
:::::: 636f828844fad9421ea6e7df053bba995febdecf ath6kl: Add HTC pipe implementation
:::::: TO: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
:::::: CC: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip