drivers/usb/gadget/udc/udc-xilinx.c:502:25: sparse: sparse: incorrect type in argument 1 (different address spaces)
kernel test robot
build botHi Piyush,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus head: a6aedb58a887aa2ea142ee914ff4030d019584bf commit: 8cb339f1c1f04baede9d54c1e40ac96247a6393b [33/42] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio config: arm-randconfig-s033-20220901 (https://download.01.org/0day-ci/archive/20220902/[email protected]/config) compiler: arm-linux-gnueabi-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://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?id=8cb339f1c1f04baede9d54c1e40ac96247a6393b
git remote add usb https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
git fetch --no-tags usb usb-linus
git checkout 8cb339f1c1f04baede9d54c1e40ac96247a6393b
# 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=arm SHELL=/bin/bash drivers/usb/gadget/udc/
If you fix the issue, kindly add following tag where applicable
sparse warnings: (new ones prefixed by >>)
>> drivers/usb/gadget/udc/udc-xilinx.c:502:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned int [usertype] *[assigned] eprambase @@ drivers/usb/gadget/udc/udc-xilinx.c:502:25: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:502:25: sparse: got unsigned int [usertype] *[assigned] eprambase >> drivers/usb/gadget/udc/udc-xilinx.c:506:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned char [usertype] *bufferptr @@ drivers/usb/gadget/udc/udc-xilinx.c:506:25: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:506:25: sparse: got unsigned char [usertype] *bufferptr drivers/usb/gadget/udc/udc-xilinx.c:520:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned int [usertype] *[assigned] eprambase @@ drivers/usb/gadget/udc/udc-xilinx.c:520:25: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:520:25: sparse: got unsigned int [usertype] *[assigned] eprambase drivers/usb/gadget/udc/udc-xilinx.c:524:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned char [usertype] *bufferptr @@ drivers/usb/gadget/udc/udc-xilinx.c:524:25: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:524:25: sparse: got unsigned char [usertype] *bufferptr >> drivers/usb/gadget/udc/udc-xilinx.c:1026:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned char [usertype] *[assigned] corebuf @@ drivers/usb/gadget/udc/udc-xilinx.c:1026:17: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:1026:17: sparse: got unsigned char [usertype] *[assigned] corebuf drivers/usb/gadget/udc/udc-xilinx.c:1620:35: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1626:31: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1641:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@ drivers/usb/gadget/udc/udc-xilinx.c:1641:34: sparse: expected unsigned short [usertype] drivers/usb/gadget/udc/udc-xilinx.c:1641:34: sparse: got restricted __le16 [usertype] drivers/usb/gadget/udc/udc-xilinx.c:1669:35: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1669:35: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1689:46: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1695:46: sparse: sparse: restricted __le16 degrades to integer >> drivers/usb/gadget/udc/udc-xilinx.c:1755:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got struct usb_ctrlrequest * @@ drivers/usb/gadget/udc/udc-xilinx.c:1755:9: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:1755:9: sparse: got struct usb_ctrlrequest * drivers/usb/gadget/udc/udc-xilinx.c:1758:29: sparse: sparse: cast from restricted __le16 drivers/usb/gadget/udc/udc-xilinx.c:1759:29: sparse: sparse: cast from restricted __le16 drivers/usb/gadget/udc/udc-xilinx.c:1760:30: sparse: sparse: cast from restricted __le16 >> drivers/usb/gadget/udc/udc-xilinx.c:1842:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got void *[assigned] buffer @@ drivers/usb/gadget/udc/udc-xilinx.c:1842:17: sparse: expected void volatile [noderef] __iomem *to drivers/usb/gadget/udc/udc-xilinx.c:1842:17: sparse: got void *[assigned] buffer drivers/usb/gadget/udc/udc-xilinx.c:1872:34: sparse: sparse: restricted __le16 degrades to integer drivers/usb/gadget/udc/udc-xilinx.c:1883:49: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] @@ got restricted __le16 [usertype] wValue @@ drivers/usb/gadget/udc/udc-xilinx.c:1883:49: sparse: expected unsigned int [usertype] drivers/usb/gadget/udc/udc-xilinx.c:1883:49: sparse: got restricted __le16 [usertype] wValue drivers/usb/gadget/udc/udc-xilinx.c:1888:47: sparse: sparse: restricted __le16 degrades to integer >> drivers/usb/gadget/udc/udc-xilinx.c:1918:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *to @@ got unsigned char [usertype] *[assigned] ep0rambase @@
drivers/usb/gadget/udc/udc-xilinx.c:1918:25: sparse: expected void volatile [noderef] __iomem *to
drivers/usb/gadget/udc/udc-xilinx.c:1918:25: sparse: got unsigned char [usertype] *[assigned] ep0rambase
vim +502 drivers/usb/gadget/udc/udc-xilinx.c
468
469 /**
470 * xudc_eptxrx - Transmits or receives data to or from an endpoint.
471 * @ep: pointer to the usb endpoint configuration structure.
472 * @req: pointer to the usb request structure.
473 * @bufferptr: pointer to buffer containing the data to be sent.
474 * @bufferlen: The number of data bytes to be sent.
475 *
476 * Return: 0 on success, -EAGAIN if no buffer is free.
477 *
478 * This function copies the transmit/receive data to/from the end point buffer
479 * and enables the buffer for transmission/reception.
480 */
481 static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req,
482 u8 *bufferptr, u32 bufferlen)
483 {
484 u32 *eprambase;
485 u32 bytestosend;
486 int rc = 0;
487 struct xusb_udc *udc = ep->udc;
488
489 bytestosend = bufferlen;
490 if (udc->dma_enabled) {
491 if (ep->is_in)
492 rc = xudc_dma_send(ep, req, bufferptr, bufferlen);
493 else
494 rc = xudc_dma_receive(ep, req, bufferptr, bufferlen);
495 return rc;
496 }
497 /* Put the transmit buffer into the correct ping-pong buffer.*/
498 if (!ep->curbufnum && !ep->buffer0ready) {
499 /* Get the Buffer address and copy the transmit data.*/
500 eprambase = (u32 __force *)(udc->addr + ep->rambase);
501 if (ep->is_in) {
> 502 memcpy_toio(eprambase, bufferptr, bytestosend);
503 udc->write_fn(udc->addr, ep->offset +
504 XUSB_EP_BUF0COUNT_OFFSET, bufferlen);
505 } else {
> 506 memcpy_toio(bufferptr, eprambase, bytestosend); 507 }
508 /*
509 * Enable the buffer for transmission.
510 */
511 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
512 1 << ep->epnumber);
513 ep->buffer0ready = 1;
514 ep->curbufnum = 1;
515 } else if (ep->curbufnum && !ep->buffer1ready) {
516 /* Get the Buffer address and copy the transmit data.*/
517 eprambase = (u32 __force *)(udc->addr + ep->rambase +
518 ep->ep_usb.maxpacket);
519 if (ep->is_in) {
520 memcpy_toio(eprambase, bufferptr, bytestosend);
521 udc->write_fn(udc->addr, ep->offset +
522 XUSB_EP_BUF1COUNT_OFFSET, bufferlen);
523 } else {
524 memcpy_toio(bufferptr, eprambase, bytestosend);
525 }
526 /*
527 * Enable the buffer for transmission.
528 */
529 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET,
530 1 << (ep->epnumber + XUSB_STATUS_EP_BUFF2_SHIFT));
531 ep->buffer1ready = 1;
532 ep->curbufnum = 0;
533 } else {
534 /* None of the ping-pong buffers are ready currently */
535 return -EAGAIN;
536 }
537 return rc;
538 }
539
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Greg Kroah-Hartman
maintainerQuoted 22 lines · kernel test robot
Hi Piyush,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus head: a6aedb58a887aa2ea142ee914ff4030d019584bf commit: 8cb339f1c1f04baede9d54c1e40ac96247a6393b [33/42] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio config: arm-randconfig-s033-20220901 (https://download.01.org/0day-ci/archive/20220902/202209020044.CX2PfZzM-lkp(a)intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0reproduce:
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/gregkh/usb.git/commit/?id=8cb339f1c1f04baede9d54c1e40ac96247a6393b
git remote add usb https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
git fetch --no-tags usb usb-linus
git checkout8cb339f1c1f04baede9d54c1e40ac96247a6393b
# save the config file
mkdirbuild_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=arm SHELL=/bin/bashdrivers/usb/gadget/udc/
Quoted 2 lines
If you fix the issue, kindly add following tag where applicable
Reported-by kernel test robot <[email protected]>
I've now reverted this offending commit.
Piyush, please fix up and resend a commit that works properly.
thanks,
greg k-h