drivers/usb/gadget/udc/tegra-xudc.c:2257:26: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Wed Jun 24 2020 - 04:34:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3e08a95294a4fb3702bb3d35ed08028433c37fe6
commit: 49db427232fe2c357d23a2d62e2db1d431f95051 usb: gadget: Add UDC driver for tegra XUSB device mode controller
date: 8 months ago
config: arm64-randconfig-s031-20200624 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-dirty
git checkout 49db427232fe2c357d23a2d62e2db1d431f95051
# save the attached .config to linux build tree
make W=1 C=1 ARCH=arm64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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/gadget/udc/tegra-xudc.c:611:9: sparse: sparse: undefined identifier 'tegra_xusb_padctl_set_vbus_override'
drivers/usb/gadget/udc/tegra-xudc.c:628:9: sparse: sparse: undefined identifier 'tegra_xusb_padctl_set_vbus_override'
drivers/usb/gadget/udc/tegra-xudc.c:711:25: sparse: sparse: undefined identifier 'tegra_xusb_padctl_set_vbus_override'
drivers/usb/gadget/udc/tegra-xudc.c:713:25: sparse: sparse: undefined identifier 'tegra_xusb_padctl_set_vbus_override'
drivers/usb/gadget/udc/tegra-xudc.c:741:31: sparse: sparse: undefined identifier 'tegra_phy_xusb_utmi_port_reset'
>> drivers/usb/gadget/udc/tegra-xudc.c:2257:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] status_buf @@ got restricted __le16 [usertype] @@
>> drivers/usb/gadget/udc/tegra-xudc.c:2257:26: sparse: expected unsigned short [usertype] status_buf
>> drivers/usb/gadget/udc/tegra-xudc.c:2257:26: sparse: got restricted __le16 [usertype]

vim +2257 drivers/usb/gadget/udc/tegra-xudc.c

2197
2198 static int tegra_xudc_ep0_get_status(struct tegra_xudc *xudc,
2199 struct usb_ctrlrequest *ctrl)
2200 {
2201 struct tegra_xudc_ep_context *ep_ctx;
2202 u32 val, ep, index = le16_to_cpu(ctrl->wIndex);
2203 u16 status = 0;
2204
2205 if (!(ctrl->bRequestType & USB_DIR_IN))
2206 return -EINVAL;
2207
2208 if ((le16_to_cpu(ctrl->wValue) != 0) ||
2209 (le16_to_cpu(ctrl->wLength) != 2))
2210 return -EINVAL;
2211
2212 switch (ctrl->bRequestType & USB_RECIP_MASK) {
2213 case USB_RECIP_DEVICE:
2214 val = xudc_readl(xudc, PORTPM);
2215
2216 if (xudc->selfpowered)
2217 status |= BIT(USB_DEVICE_SELF_POWERED);
2218
2219 if ((xudc->gadget.speed < USB_SPEED_SUPER) &&
2220 (val & PORTPM_RWE))
2221 status |= BIT(USB_DEVICE_REMOTE_WAKEUP);
2222
2223 if (xudc->gadget.speed == USB_SPEED_SUPER) {
2224 if (val & PORTPM_U1E)
2225 status |= BIT(USB_DEV_STAT_U1_ENABLED);
2226 if (val & PORTPM_U2E)
2227 status |= BIT(USB_DEV_STAT_U2_ENABLED);
2228 }
2229 break;
2230 case USB_RECIP_INTERFACE:
2231 if (xudc->gadget.speed == USB_SPEED_SUPER) {
2232 status |= USB_INTRF_STAT_FUNC_RW_CAP;
2233 val = xudc_readl(xudc, PORTPM);
2234 if (val & PORTPM_FRWE)
2235 status |= USB_INTRF_STAT_FUNC_RW;
2236 }
2237 break;
2238 case USB_RECIP_ENDPOINT:
2239 ep = (index & USB_ENDPOINT_NUMBER_MASK) * 2 +
2240 ((index & USB_DIR_IN) ? 1 : 0);
2241 ep_ctx = &xudc->ep_context[ep];
2242
2243 if ((xudc->device_state != USB_STATE_CONFIGURED) &&
2244 ((xudc->device_state != USB_STATE_ADDRESS) || (ep != 0)))
2245 return -EINVAL;
2246
2247 if (ep_ctx_read_state(ep_ctx) == EP_STATE_DISABLED)
2248 return -EINVAL;
2249
2250 if (xudc_readl(xudc, EP_HALT) & BIT(ep))
2251 status |= BIT(USB_ENDPOINT_HALT);
2252 break;
2253 default:
2254 return -EINVAL;
2255 }
2256
> 2257 xudc->status_buf = cpu_to_le16(status);
2258 return tegra_xudc_ep0_queue_data(xudc, &xudc->status_buf,
2259 sizeof(xudc->status_buf),
2260 no_op_complete);
2261 }
2262

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

Attachment: .config.gz
Description: application/gzip