On Mon, Dec 14, 2020 at 11:26:22AM +0000, David Laight wrote:
> 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.

Why?  This is fine, it's better to operate on the value that needs to be
operated on.

greg k-h

Reply via email to