drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: sparse: incorrect type in argument 1 (different base types)

From: kbuild test robot
Date: Wed May 27 2020 - 06:51:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 444fc5cde64330661bf59944c43844e7d4c2ccd8
commit: 48ba02b2e2b1a1c80718e93fefe99c8319597c4a usb: gadget: add udc driver for max3420
date: 2 months ago
config: sparc64-randconfig-s031-20200527 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-240-gf0fe1cd9-dirty
git checkout 48ba02b2e2b1a1c80718e93fefe99c8319597c4a
# save the attached .config to linux build tree
make W=1 C=1 ARCH=sparc64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

./arch/sparc/include/generated/uapi/asm/unistd_64.h:379:40: sparse: sparse: no newline at end of file
drivers/usb/gadget/udc/max3420_udc.c:555:41: sparse: sparse: restricted __le16 degrades to integer
drivers/usb/gadget/udc/max3420_udc.c:556:31: sparse: sparse: restricted __le16 degrades to integer
drivers/usb/gadget/udc/max3420_udc.c:570:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] status @@ got restricted __le16 [usertype] @@
drivers/usb/gadget/udc/max3420_udc.c:570:16: sparse: expected unsigned short [assigned] [usertype] status
drivers/usb/gadget/udc/max3420_udc.c:570:16: sparse: got restricted __le16 [usertype]
drivers/usb/gadget/udc/max3420_udc.c:588:31: sparse: sparse: restricted __le16 degrades to integer
drivers/usb/gadget/udc/max3420_udc.c:602:32: sparse: sparse: restricted __le16 degrades to integer
drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: sparse: cast from restricted __le16
>> drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [addressable] [usertype] wValue @@
drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: expected unsigned short [usertype] val
drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: got restricted __le16 [addressable] [usertype] wValue
drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: sparse: cast from restricted __le16
drivers/usb/gadget/udc/max3420_udc.c:631:29: sparse: sparse: cast from restricted __le16
drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: sparse: cast from restricted __le16
>> drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [addressable] [usertype] wIndex @@
drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: expected unsigned short [usertype] val
drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: got restricted __le16 [addressable] [usertype] wIndex
drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: sparse: cast from restricted __le16
drivers/usb/gadget/udc/max3420_udc.c:632:29: sparse: sparse: cast from restricted __le16
drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: sparse: cast from restricted __le16
>> drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [addressable] [usertype] wLength @@
drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: expected unsigned short [usertype] val
drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: got restricted __le16 [addressable] [usertype] wLength
drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: sparse: cast from restricted __le16
drivers/usb/gadget/udc/max3420_udc.c:633:30: sparse: sparse: cast from restricted __le16

vim +631 drivers/usb/gadget/udc/max3420_udc.c

622
623 static void max3420_handle_setup(struct max3420_udc *udc)
624 {
625 struct usb_ctrlrequest setup;
626 u8 addr;
627
628 spi_rd_buf(udc, MAX3420_REG_SUDFIFO, (void *)&setup, 8);
629
630 udc->setup = setup;
> 631 udc->setup.wValue = cpu_to_le16(setup.wValue);
> 632 udc->setup.wIndex = cpu_to_le16(setup.wIndex);
> 633 udc->setup.wLength = cpu_to_le16(setup.wLength);
634
635 switch (udc->setup.bRequest) {
636 case USB_REQ_GET_STATUS:
637 /* Data+Status phase form udc */
638 if ((udc->setup.bRequestType &
639 (USB_DIR_IN | USB_TYPE_MASK)) !=
640 (USB_DIR_IN | USB_TYPE_STANDARD)) {
641 break;
642 }
643 return max3420_getstatus(udc);
644 case USB_REQ_SET_ADDRESS:
645 /* Status phase from udc */
646 if (udc->setup.bRequestType != (USB_DIR_OUT |
647 USB_TYPE_STANDARD | USB_RECIP_DEVICE)) {
648 break;
649 }
650 addr = spi_rd8_ack(udc, MAX3420_REG_FNADDR, 1);
651 dev_dbg(udc->dev, "Assigned Address=%d\n", udc->setup.wValue);
652 return;
653 case USB_REQ_CLEAR_FEATURE:
654 case USB_REQ_SET_FEATURE:
655 /* Requests with no data phase, status phase from udc */
656 if ((udc->setup.bRequestType & USB_TYPE_MASK)
657 != USB_TYPE_STANDARD)
658 break;
659 return max3420_set_clear_feature(udc);
660 default:
661 break;
662 }
663
664 if (udc->driver->setup(&udc->gadget, &setup) < 0) {
665 /* Stall EP0 */
666 spi_wr8(udc, MAX3420_REG_EPSTALLS,
667 STLEP0IN | STLEP0OUT | STLSTAT);
668 }
669 }
670

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip