sound/usb/midi2.c:548:16: sparse: sparse: cast to restricted __le16
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/midi20 head: 77700b81bd0e47d89d50eb4b3f2f323492f79998 commit: ff49d1df79aef7580fe3ac99d17c3f886655d080 [9/40] ALSA: usb-audio: USB MIDI 2.0 UMP support config: microblaze-randconfig-s032-20230526 (https://download.01.org/0day-ci/archive/20230527/[email protected]/config) compiler: microblaze-linux-gcc (GCC) 12.1.0
reproduce:
mkdir -p ~/bin
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://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=ff49d1df79aef7580fe3ac99d17c3f886655d080
git remote add tiwai-sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
git fetch --no-tags tiwai-sound topic/midi20
git checkout ff49d1df79aef7580fe3ac99d17c3f886655d080
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 ~/bin/make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze SHELL=/bin/bash sound/usb/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> sound/usb/midi2.c:548:16: sparse: sparse: cast to restricted __le16 >> sound/usb/midi2.c:548:16: sparse: sparse: cast to restricted __le16 >> sound/usb/midi2.c:548:16: sparse: sparse: cast to restricted __le16 >> sound/usb/midi2.c:548:16: sparse: sparse: cast to restricted __le16
vim +548 sound/usb/midi2.c
530
531 /* get the full group terminal block descriptors and return the size */
532 static int get_group_terminal_block_descs(struct snd_usb_midi2_interface *umidi)
533 {
534 struct usb_host_interface *hostif = umidi->hostif;
535 struct usb_device *dev = umidi->chip->dev;
536 struct usb_ms20_gr_trm_block_header_descriptor header = { 0 };
537 unsigned char *data;
538 int err, size;
539
540 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
541 USB_REQ_GET_DESCRIPTOR,
542 USB_RECIP_INTERFACE | USB_TYPE_STANDARD | USB_DIR_IN,
543 USB_DT_CS_GR_TRM_BLOCK << 8 | hostif->desc.bAlternateSetting,
544 hostif->desc.bInterfaceNumber,
545 &header, sizeof(header));
546 if (err < 0)
547 return err;
> 548 size = __le16_to_cpu(header.wTotalLength);
549 if (!size) {
550 dev_err(&dev->dev, "Failed to get GTB descriptors for %d:%d\n",
551 hostif->desc.bInterfaceNumber, hostif->desc.bAlternateSetting);
552 return -EINVAL;
553 }
554
555 data = kzalloc(size, GFP_KERNEL);
556 if (!data)
557 return -ENOMEM;
558
559 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
560 USB_REQ_GET_DESCRIPTOR,
561 USB_RECIP_INTERFACE | USB_TYPE_STANDARD | USB_DIR_IN,
562 USB_DT_CS_GR_TRM_BLOCK << 8 | hostif->desc.bAlternateSetting,
563 hostif->desc.bInterfaceNumber, data, size); 564 if (err < 0) {
565 kfree(data);
566 return err;
567 }
568
569 umidi->blk_descs = data;
570 umidi->blk_desc_size = size;
571 return 0;
572 }
573
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki