[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <X9dVsI5CDbXEyU/w@kroah.com>
Date: Mon, 14 Dec 2020 13:08:16 +0100
From: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
To: David Laight <David.Laight@...lab.com>
Cc: 'Pawel Laszczak' <pawell@...ence.com>,
"peter.chen@....com" <peter.chen@....com>,
"rogerq@...com" <rogerq@...com>,
"a-govindraju@...com" <a-govindraju@...com>,
"nsekhar@...com" <nsekhar@...com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kurahul@...ence.com" <kurahul@...ence.com>
Subject: Re: [PATCH] usb: cdns3: Fixes for sparse warnings
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
Powered by blists - more mailing lists