lkml.org 
[lkml]   [2020]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] usb: cdns3: Fixes for sparse warnings
Date
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)

\
 
 \ /
  Last update: 2020-12-14 12:28    [W:1.232 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site