diff options
author | Pawel Laszczak <pawell@cadence.com> | 2020-12-14 13:03:44 +0100 |
---|---|---|
committer | Peter Chen <peter.chen@nxp.com> | 2020-12-29 12:36:13 +0800 |
commit | 16e3610154d0c992a0558d684213201f5355bd76 (patch) | |
tree | 208965307f82a96acd770c0a09ff07ad5fb197b3 /drivers/usb/cdns3/cdnsp-ep0.c | |
parent | fba8701baed76eac00b84b59f09f6a077f24c534 (diff) | |
download | linux-16e3610154d0c992a0558d684213201f5355bd76.tar.gz linux-16e3610154d0c992a0558d684213201f5355bd76.tar.bz2 linux-16e3610154d0c992a0558d684213201f5355bd76.zip |
usb: cdnsp: Fixes for sparse warnings
Patch fixes all sparse warnings in cdsnp driver.
It fixes the following warnings:
cdnsp-ring.c:1441: warning: incorrect type in assignment
cdnsp-ring.c:1444: warning: restricted __le32 degrades to integer
cdnsp-ring.c:2200: warning: dubious: x | !y
cdnsp-gadget.c:501: warning: incorrect type in assignment
cdnsp-gadget.c:504: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:507: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:508: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:509: warning: invalid assignment: |=
cdnsp-gadget.c:510: warning: cast from restricted __le32
cdnsp-gadget.c:558: warning: incorrect type in assignment
cdnsp-gadget.c:561: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:570: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:1571: warning: incorrect type in argument 1
cdnsp-gadget.c:1602: warning: restricted __le32 degrades to integer
cdnsp-gadget.c:1760: warning: incorrect type in assignment
cdnsp-gadget.c:1762: warning: incorrect type in assignment
cdnsp-gadget.c:1763: warning: incorrect type in assignment
cdnsp-gadget.c:1764: warning: incorrect type in assignment
cdnsp-gadget.c:1765: warning: incorrect type in assignment
cdnsp-gadget.c:1766: warning: incorrect type in assignment
cdnsp-gadget.c:1767: warning: incorrect type in assignment
cdnsp-gadget.c:458: warning: cast truncates bits from constant value
(ffffffff07ffffff becomes 7ffffff)
cdnsp-gadget.c:666: warning: cast truncates bits from constant value
(ffffffff07ffffff becomes 7ffffff)
cdnsp-mem.c:762: warning: incorrect type in assignment
cdnsp-mem.c:763: warning: incorrect type in assignment
cdnsp-mem.c:928: warning: cast from restricted __le16
cdnsp-mem.c:1187: warning: incorrect type in assignment
cdnsp-mem.c:1191: warning: incorrect type in assignment
cdnsp-ep0.c:142: warning: incorrect type in assignment
cdnsp-ep0.c:144: warning: restricted __le32 degrades to integer
cdnsp-ep0.c:147: warning: restricted __le32 degrades to integer
cdnsp-ep0.c:148: warning: restricted __le32 degrades to integer
cdnsp-ep0.c:179: warning: incorrect type in argument 1
cdnsp-ep0.c:311: warning: incorrect type in argument 1
cdnsp-ep0.c:469: warning: incorrect type in assignment
cdnsp-trace.h:611:1: warning: cast from restricted __le32
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>
Diffstat (limited to 'drivers/usb/cdns3/cdnsp-ep0.c')
-rw-r--r-- | drivers/usb/cdns3/cdnsp-ep0.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/usb/cdns3/cdnsp-ep0.c b/drivers/usb/cdns3/cdnsp-ep0.c index d55b59ed7381..e2b1bcb3f80e 100644 --- a/drivers/usb/cdns3/cdnsp-ep0.c +++ b/drivers/usb/cdns3/cdnsp-ep0.c @@ -137,10 +137,8 @@ int cdnsp_status_stage(struct cdnsp_device *pdev) return cdnsp_ep_enqueue(pdev->ep0_preq.pep, &pdev->ep0_preq); } -static int cdnsp_w_index_to_ep_index(__le32 wIndex) +static int cdnsp_w_index_to_ep_index(u16 wIndex) { - wIndex = le32_to_cpu(wIndex); - if (!(wIndex & USB_ENDPOINT_NUMBER_MASK)) return 0; @@ -176,7 +174,8 @@ static int cdnsp_ep0_handle_status(struct cdnsp_device *pdev, */ return cdnsp_ep0_delegate_req(pdev, ctrl); case USB_RECIP_ENDPOINT: - pep = &pdev->eps[cdnsp_w_index_to_ep_index(ctrl->wIndex)]; + ep_sts = cdnsp_w_index_to_ep_index(le16_to_cpu(ctrl->wIndex)); + pep = &pdev->eps[ep_sts]; ep_sts = GET_EP_CTX_STATE(pep->out_ctx); /* check if endpoint is stalled */ @@ -305,10 +304,10 @@ static int cdnsp_ep0_handle_feature_endpoint(struct cdnsp_device *pdev, int set) { struct cdnsp_ep *pep; - u32 wValue; + u16 wValue; wValue = le16_to_cpu(ctrl->wValue); - pep = &pdev->eps[cdnsp_w_index_to_ep_index(ctrl->wIndex)]; + pep = &pdev->eps[cdnsp_w_index_to_ep_index(le16_to_cpu(ctrl->wIndex))]; switch (wValue) { case USB_ENDPOINT_HALT: @@ -435,7 +434,7 @@ void cdnsp_setup_analyze(struct cdnsp_device *pdev) { struct usb_ctrlrequest *ctrl = &pdev->setup; int ret = 0; - __le16 len; + u16 len; trace_cdnsp_ctrl_req(ctrl); |