[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210190429.I03NfzME-lkp@intel.com>
Date: Wed, 19 Oct 2022 04:39:12 +0800
From: kernel test robot <lkp@...el.com>
To: Janne Grunau <j@...nau.net>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Hector Martin <marcan@...can.st>
Subject: [asahilinux:bits/090-spi-hid 23/34]
drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse: sparse: incorrect
type in assignment (different base types)
tree: https://github.com/AsahiLinux/linux bits/090-spi-hid
head: bd3ea9c827680dbc49e10be104d6bb78b0f5527c
commit: 44717a151a8637bd88bd2a41b5d8e05625e4626f [23/34] WIP: HID: transport: spi: add Apple SPI transport
config: csky-randconfig-s043-20221018
compiler: csky-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://github.com/AsahiLinux/linux/commit/44717a151a8637bd88bd2a41b5d8e05625e4626f
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux bits/090-spi-hid
git checkout 44717a151a8637bd88bd2a41b5d8e05625e4626f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash drivers/hid/spi-hid/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] length @@ got unsigned int @@
drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse: expected restricted __le16 [usertype] length
drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse: got unsigned int
drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] crc16 @@ got unsigned short @@
drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse: expected restricted __le16 [usertype] crc16
drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse: got unsigned short
drivers/hid/spi-hid/spi-hid-apple-core.c:259:21: sparse: sparse: symbol 'spihid_get_data' was not declared. Should it be static?
>> drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned int [usertype] len @@ got restricted __le16 [usertype] length @@
drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse: expected unsigned int [usertype] len
drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse: got restricted __le16 [usertype] length
drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse: sparse: incorrect type in argument 4 (different base types) @@ expected unsigned int [usertype] len @@ got restricted __le16 [usertype] length @@
drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse: expected unsigned int [usertype] len
drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse: got restricted __le16 [usertype] length
drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse: sparse: incorrect type in argument 6 (different base types) @@ expected unsigned int [usertype] len @@ got restricted __le16 [usertype] length @@
drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse: expected unsigned int [usertype] len
drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse: got restricted __le16 [usertype] length
drivers/hid/spi-hid/spi-hid-apple-core.c:686:16: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/spi-hid/spi-hid-apple-core.c:700:43: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/spi-hid/spi-hid-apple-core.c:703:23: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/spi-hid/spi-hid-apple-core.c:704:24: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/spi-hid/spi-hid-apple-core.c:704:47: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/spi-hid/spi-hid-apple-core.c:709:38: sparse: sparse: restricted __le16 degrades to integer
>> drivers/hid/spi-hid/spi-hid-apple-core.c:709:62: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] @@ got restricted __le16 [usertype] length @@
drivers/hid/spi-hid/spi-hid-apple-core.c:709:62: sparse: expected unsigned int [usertype]
drivers/hid/spi-hid/spi-hid-apple-core.c:709:62: sparse: got restricted __le16 [usertype] length
drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse: sparse: invalid assignment: +=
drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse: left side has type unsigned int
drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse: right side has type restricted __le16
drivers/hid/spi-hid/spi-hid-apple-core.c:735:23: sparse: sparse: restricted __le16 degrades to integer
vim +233 drivers/hid/spi-hid/spi-hid-apple-core.c
187
188 /*
189 * how HID is mapped onto the protocol is not fully clear. This are the known
190 * reports/request:
191 *
192 * pkt.flags pkt.dev? msg.u0 msg.u1 msg.u2
193 * info 0x40 0xd0 0x20 0x01 0xd0
194 *
195 * info mngt: 0x40 0xd0 0x20 0x10 0x00
196 * info kbd: 0x40 0xd0 0x20 0x10 0x01
197 * info tp: 0x40 0xd0 0x20 0x10 0x02
198 *
199 * desc kbd: 0x40 0xd0 0x20 0x10 0x01
200 * desc trackpad: 0x40 0xd0 0x20 0x10 0x02
201 *
202 * mt mode: 0x40 0x02 0x52 0x02 0x00 set protocol?
203 * capslock led 0x40 0x01 0x51 0x01 0x00 output report
204 *
205 * report kbd: 0x20 0x01 0x10 0x01 0x00 input report
206 * report tp: 0x20 0x02 0x10 0x02 0x00 input report
207 *
208 */
209
210
211 static int spihid_apple_request(struct spihid_apple *spihid, u8 target, u8 unk0,
212 u8 unk1, u8 unk2, u16 resp_len, u8 *buf,
213 size_t len)
214 {
215 struct spihid_transfer_packet *pkt;
216 struct spihid_msg_hdr *hdr;
217 u16 crc;
218 int err;
219
220 /* know reports are small enoug to fit in a single packet */
221 if (len > sizeof(pkt->data) - sizeof(*hdr) - sizeof(__le16))
222 return -EINVAL;
223
224 err = mutex_lock_interruptible(&spihid->tx_lock);
225 if (err < 0)
226 return err;
227
228 pkt = (struct spihid_transfer_packet *)spihid->tx_buf;
229
230 memset(pkt, 0, sizeof(*pkt));
231 pkt->flags = SPIHID_WRITE_PACKET;
232 pkt->device = target;
> 233 pkt->length = sizeof(*hdr) + len + sizeof(__le16);
234
235 hdr = (struct spihid_msg_hdr *)&pkt->data[0];
236 hdr->unknown0 = unk0;
237 hdr->unknown1 = unk1;
238 hdr->unknown2 = unk2;
239 hdr->id = spihid->msg_id++;
240 hdr->rsplen = cpu_to_le16(resp_len);
241 hdr->length = cpu_to_le16(len);
242
243 if (len)
244 memcpy(pkt->data + sizeof(*hdr), buf, len);
245 crc = crc16(0, &pkt->data[0], sizeof(*hdr) + len);
246 put_unaligned_le16(crc, pkt->data + sizeof(*hdr) + len);
247
248 pkt->crc16 = crc16(0, spihid->tx_buf,
249 offsetof(struct spihid_transfer_packet, crc16));
250
251 err = spi_sync(spihid->spidev, &spihid->tx_msg);
252 mutex_unlock(&spihid->tx_lock);
253 if (err < 0)
254 return err;
255
256 return (int)len;
257 }
258
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (162543 bytes)
Powered by blists - more mailing lists