From: Pawel Laszczak
> Sent: 14 December 2020 11:05
>
> Patch fixes the following warnings:
...
> cdns3-ep0.c:367: sparse: warning: restricted __le16 degrades to integer
...
> diff --git a/drivers/usb/cdns3/cdns3-ep0.c b/drivers/usb/cdns3/cdns3-ep0.c
> index b0390fe9a396..9a17802275d5 100644
> --- a/drivers/usb/cdns3/cdns3-ep0.c
> +++ b/drivers/usb/cdns3/cdns3-ep0.c
> @@ -364,7 +364,7 @@ static int cdns3_ep0_feature_handle_endpoint(struct
> cdns3_device *priv_dev,
> if (le16_to_cpu(ctrl->wValue) != USB_ENDPOINT_HALT)
> return -EINVAL;
>
> - if (!(ctrl->wIndex & ~USB_DIR_IN))
> + if (!(le16_to_cpu(ctrl->wIndex) & ~USB_DIR_IN))
> return 0;
It's generally best to byteswap the constant.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT,
UK
Registration No: 1397386 (Wales)