Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: cdns3: Fixes for sparse warnings

Patch fixes the following warnings:
cdns3-gadget.c:1203: sparse: warning: incorrect type
in assignment (different base types)
cdns3-gadget.c:1203: sparse: expected restricted __le32 [usertype] length
cdns3-gadget.c:1203: sparse: got unsigned long
cdns3-gadget.c:1250: sparse: warning: invalid assignment: |=
cdns3-gadget.c:1250: sparse: left side has type restricted __le32
cdns3-gadget.c:1250: sparse: right side has type unsigned long
cdns3-gadget.c:1253: sparse: warning: invalid assignment: |=
cdns3-gadget.c:1253: sparse: left side has type restricted __le32
cdns3-gadget.c:1253: sparse: right side has type unsigned long
cdns3-ep0.c:367: sparse: warning: restricted __le16 degrades to integer
cdns3-ep0.c:792: sparse: warning: symbol 'cdns3_gadget_ep0_ops' was not
declared. Should it be static?

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>

authored by

Pawel Laszczak and committed by
Peter Chen
fba8701b e2d60f8c

+5 -5
+2 -2
drivers/usb/cdns3/cdns3-ep0.c
··· 364 364 if (le16_to_cpu(ctrl->wValue) != USB_ENDPOINT_HALT) 365 365 return -EINVAL; 366 366 367 - if (!(ctrl->wIndex & ~USB_DIR_IN)) 367 + if (!(le16_to_cpu(ctrl->wIndex) & ~USB_DIR_IN)) 368 368 return 0; 369 369 370 370 index = cdns3_ep_addr_to_index(le16_to_cpu(ctrl->wIndex)); ··· 789 789 return 0; 790 790 } 791 791 792 - const struct usb_ep_ops cdns3_gadget_ep0_ops = { 792 + static const struct usb_ep_ops cdns3_gadget_ep0_ops = { 793 793 .enable = cdns3_gadget_ep0_enable, 794 794 .disable = cdns3_gadget_ep0_disable, 795 795 .alloc_request = cdns3_gadget_ep_alloc_request,
+3 -3
drivers/usb/cdns3/cdns3-gadget.c
··· 1200 1200 td_size = DIV_ROUND_UP(request->length, 1201 1201 priv_ep->endpoint.maxpacket); 1202 1202 if (priv_dev->gadget.speed == USB_SPEED_SUPER) 1203 - trb->length = TRB_TDL_SS_SIZE(td_size); 1203 + trb->length = cpu_to_le32(TRB_TDL_SS_SIZE(td_size)); 1204 1204 else 1205 1205 control |= TRB_TDL_HS_SIZE(td_size); 1206 1206 } ··· 1247 1247 priv_req->trb->control = cpu_to_le32(control); 1248 1248 1249 1249 if (sg_supported) { 1250 - trb->control |= TRB_ISP; 1250 + trb->control |= cpu_to_le32(TRB_ISP); 1251 1251 /* Don't set chain bit for last TRB */ 1252 1252 if (sg_iter < num_trb - 1) 1253 - trb->control |= TRB_CHAIN; 1253 + trb->control |= cpu_to_le32(TRB_CHAIN); 1254 1254 1255 1255 s = sg_next(s); 1256 1256 }