staging: emxx_udc: Added missing le16_to_cpu conversions

Fixed sparse tool warnings due to missing convesion from
le16 to cpu endienness.

Signed-off-by: Carmeli Tamir <carmeli.tamir@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Carmeli Tamir 2018-11-07 15:44:24 -05:00 committed by Greg Kroah-Hartman
parent 64407f6e7d
commit 484a415951

View file

@ -135,6 +135,7 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req)
{ {
u8 recipient; u8 recipient;
u16 selector; u16 selector;
u16 wIndex;
u32 test_mode; u32 test_mode;
struct usb_ctrlrequest *p_ctrl; struct usb_ctrlrequest *p_ctrl;
struct nbu2ss_udc *udc; struct nbu2ss_udc *udc;
@ -149,10 +150,11 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req)
/*-------------------------------------------------*/ /*-------------------------------------------------*/
/* SET_FEATURE */ /* SET_FEATURE */
recipient = (u8)(p_ctrl->bRequestType & USB_RECIP_MASK); recipient = (u8)(p_ctrl->bRequestType & USB_RECIP_MASK);
selector = p_ctrl->wValue; selector = le16_to_cpu(p_ctrl->wValue);
if ((recipient == USB_RECIP_DEVICE) && if ((recipient == USB_RECIP_DEVICE) &&
(selector == USB_DEVICE_TEST_MODE)) { (selector == USB_DEVICE_TEST_MODE)) {
test_mode = (u32)(p_ctrl->wIndex >> 8); wIndex = le16_to_cpu(p_ctrl->wIndex);
test_mode = (u32)(wIndex >> 8);
_nbu2ss_set_test_mode(udc, test_mode); _nbu2ss_set_test_mode(udc, test_mode);
} }
} }
@ -1449,8 +1451,8 @@ static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset)
{ {
u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK);
u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN);
u16 selector = udc->ctrl.wValue; u16 selector = le16_to_cpu(udc->ctrl.wValue);
u16 wIndex = udc->ctrl.wIndex; u16 wIndex = le16_to_cpu(udc->ctrl.wIndex);
u8 ep_adrs; u8 ep_adrs;
int result = -EOPNOTSUPP; int result = -EOPNOTSUPP;
@ -1549,8 +1551,8 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN))
return result; return result;
length = min_t(u16, udc->ctrl.wLength, sizeof(status_data)); length =
min_t(u16, le16_to_cpu(udc->ctrl.wLength), sizeof(status_data));
switch (recipient) { switch (recipient) {
case USB_RECIP_DEVICE: case USB_RECIP_DEVICE:
if (udc->ctrl.wIndex == 0x0000) { if (udc->ctrl.wIndex == 0x0000) {
@ -1565,8 +1567,8 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
break; break;
case USB_RECIP_ENDPOINT: case USB_RECIP_ENDPOINT:
if (0x0000 == (udc->ctrl.wIndex & 0xFF70)) { if (0x0000 == (le16_to_cpu(udc->ctrl.wIndex) & 0xFF70)) {
ep_adrs = (u8)(udc->ctrl.wIndex & 0xFF); ep_adrs = (u8)(le16_to_cpu(udc->ctrl.wIndex) & 0xFF);
result = _nbu2ss_get_ep_stall(udc, ep_adrs); result = _nbu2ss_get_ep_stall(udc, ep_adrs);
if (result > 0) if (result > 0)
@ -1606,7 +1608,7 @@ static int std_req_set_feature(struct nbu2ss_udc *udc)
static int std_req_set_address(struct nbu2ss_udc *udc) static int std_req_set_address(struct nbu2ss_udc *udc)
{ {
int result = 0; int result = 0;
u32 wValue = udc->ctrl.wValue; u32 wValue = le16_to_cpu(udc->ctrl.wValue);
if ((udc->ctrl.bRequestType != 0x00) || if ((udc->ctrl.bRequestType != 0x00) ||
(udc->ctrl.wIndex != 0x0000) || (udc->ctrl.wIndex != 0x0000) ||
@ -1628,7 +1630,7 @@ static int std_req_set_address(struct nbu2ss_udc *udc)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int std_req_set_configuration(struct nbu2ss_udc *udc) static int std_req_set_configuration(struct nbu2ss_udc *udc)
{ {
u32 config_value = (u32)(udc->ctrl.wValue & 0x00ff); u32 config_value = (u32)(le16_to_cpu(udc->ctrl.wValue) & 0x00ff);
if ((udc->ctrl.wIndex != 0x0000) || if ((udc->ctrl.wIndex != 0x0000) ||
(udc->ctrl.wLength != 0x0000) || (udc->ctrl.wLength != 0x0000) ||