mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
usb: fotg210-udc: Fix ages old endianness issues
[ Upstream commit46ed6026ca] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2fcb7c7d52
commit
775a6f8bed
@@ -629,10 +629,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,17 +713,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;
|
||||||
|
|||||||
Reference in New Issue
Block a user