drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Tue Apr 06 2021 - 00:21:29 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0a50438c84363bd37fe18fe432888ae9a074dcab
commit: 005b73d0dd83c9cb9420a196bea8070cde30ecac m68knommu: __force type casts for raw IO access
date: 8 months ago
config: m68k-randconfig-s032-20210406 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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.3-279-g6d5d9b42-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=005b73d0dd83c9cb9420a196bea8070cde30ecac
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 005b73d0dd83c9cb9420a196bea8070cde30ecac
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k

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/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted __le32
drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted __le16
drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted __le16
drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted __le16
drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted __le16
drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __le32 [usertype] @@
drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: expected unsigned int [usertype] val
drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: got restricted __le32 [usertype]
>> drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: expected unsigned short volatile [usertype]
drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: got restricted __le16 [usertype]
drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short volatile [usertype] @@ got restricted __le16 [usertype] @@
drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: expected unsigned short volatile [usertype]
drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: got restricted __le16 [usertype]

vim +270 drivers/usb/isp1760/isp1760-udc.c

0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 241
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 242 static void isp1760_udc_transmit(struct isp1760_ep *ep,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 243 struct isp1760_request *req)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 244 {
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 245 struct isp1760_udc *udc = ep->udc;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 246 u32 *buf = req->req.buf + req->req.actual;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 247 int i;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 248
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 249 req->packet_size = min(req->req.length - req->req.actual,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 250 ep->maxpacket);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 251
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 252 dev_dbg(udc->isp->dev, "%s: transferring %u bytes (%u/%u done)\n",
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 253 __func__, req->packet_size, req->req.actual,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 254 req->req.length);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 255
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 256 __isp1760_udc_select_ep(ep, USB_DIR_IN);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 257
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 258 if (req->packet_size)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 259 isp1760_udc_write(udc, DC_BUFLEN, req->packet_size);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 260
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 261 /*
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 262 * Make sure not to write more than one extra byte, otherwise extra data
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 263 * will stay in the FIFO and will be transmitted during the next control
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 264 * request. The endpoint control CLBUF bit is supposed to allow flushing
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 265 * the FIFO for this kind of conditions, but doesn't seem to work.
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 266 */
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 267 for (i = req->packet_size; i > 2; i -= 4, ++buf)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 268 isp1760_udc_write(udc, DC_DATAPORT, cpu_to_le32(*buf));
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 269 if (i > 0)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 @270 writew(cpu_to_le16(*(u16 *)buf), udc->regs + DC_DATAPORT);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 271
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 272 if (ep->addr == 0)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 273 isp1760_udc_write(udc, DC_CTRLFUNC, DC_DSEN);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 274 if (!req->packet_size)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 275 isp1760_udc_write(udc, DC_CTRLFUNC, DC_VENDP);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 276 }
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21 277

:::::: The code at line 270 was first introduced by commit
:::::: 0316ca6319b98e485325be98a47d08fed07ead43 usb: isp1760: Add device controller support

:::::: TO: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
:::::: CC: Felipe Balbi <balbi@xxxxxx>

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

Attachment: .config.gz
Description: application/gzip