mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
usb: fotg210-udc: Fix ages old endianness issues
The code in the FOTG210 driver isn't entirely endianness-agnostic
as reported by the kernel robot sparse testing. This came to
the surface while moving the files around.
The driver is only used on little-endian systems, so this causes
no real-world regression, but it is nice to be strict and have
some compile coverage also on big endian machines, so fix it
up with the right LE accessors.
Fixes: b84a8dee23
("usb: gadget: add Faraday fotg210_udc driver")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-usb/202211110910.0dJ7nZCn-lkp@intel.com/
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20221111090317.94228-1-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
00fb05ff87
commit
46ed6026ca
1 changed files with 6 additions and 6 deletions
|
@ -630,10 +630,10 @@ static void fotg210_request_error(struct fotg210_udc *fotg210)
|
||||||
static void fotg210_set_address(struct fotg210_udc *fotg210,
|
static void fotg210_set_address(struct fotg210_udc *fotg210,
|
||||||
struct usb_ctrlrequest *ctrl)
|
struct usb_ctrlrequest *ctrl)
|
||||||
{
|
{
|
||||||
if (ctrl->wValue >= 0x0100) {
|
if (le16_to_cpu(ctrl->wValue) >= 0x0100) {
|
||||||
fotg210_request_error(fotg210);
|
fotg210_request_error(fotg210);
|
||||||
} else {
|
} else {
|
||||||
fotg210_set_dev_addr(fotg210, ctrl->wValue);
|
fotg210_set_dev_addr(fotg210, le16_to_cpu(ctrl->wValue));
|
||||||
fotg210_set_cxdone(fotg210);
|
fotg210_set_cxdone(fotg210);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,17 +714,17 @@ static void fotg210_get_status(struct fotg210_udc *fotg210,
|
||||||
|
|
||||||
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
switch (ctrl->bRequestType & USB_RECIP_MASK) {
|
||||||
case USB_RECIP_DEVICE:
|
case USB_RECIP_DEVICE:
|
||||||
fotg210->ep0_data = 1 << USB_DEVICE_SELF_POWERED;
|
fotg210->ep0_data = cpu_to_le16(1 << USB_DEVICE_SELF_POWERED);
|
||||||
break;
|
break;
|
||||||
case USB_RECIP_INTERFACE:
|
case USB_RECIP_INTERFACE:
|
||||||
fotg210->ep0_data = 0;
|
fotg210->ep0_data = cpu_to_le16(0);
|
||||||
break;
|
break;
|
||||||
case USB_RECIP_ENDPOINT:
|
case USB_RECIP_ENDPOINT:
|
||||||
epnum = ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK;
|
epnum = ctrl->wIndex & USB_ENDPOINT_NUMBER_MASK;
|
||||||
if (epnum)
|
if (epnum)
|
||||||
fotg210->ep0_data =
|
fotg210->ep0_data =
|
||||||
fotg210_is_epnstall(fotg210->ep[epnum])
|
cpu_to_le16(fotg210_is_epnstall(fotg210->ep[epnum])
|
||||||
<< USB_ENDPOINT_HALT;
|
<< USB_ENDPOINT_HALT);
|
||||||
else
|
else
|
||||||
fotg210_request_error(fotg210);
|
fotg210_request_error(fotg210);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue