From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: David Laight <David.Laight@aculab.com>
Cc: 'Pawel Laszczak' <pawell@cadence.com>,
"peter.chen@nxp.com" <peter.chen@nxp.com>,
"rogerq@ti.com" <rogerq@ti.com>,
"a-govindraju@ti.com" <a-govindraju@ti.com>,
"nsekhar@ti.com" <nsekhar@ti.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kurahul@cadence.com" <kurahul@cadence.com>
Subject: Re: [PATCH] usb: cdns3: Fixes for sparse warnings
Date: Mon, 14 Dec 2020 13:08:16 +0100 [thread overview]
Message-ID: <X9dVsI5CDbXEyU/w@kroah.com> (raw)
In-Reply-To: <d232a54761a7473692976188aba0a5f6@AcuMS.aculab.com>
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
prev parent reply other threads:[~2020-12-14 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 11:04 Pawel Laszczak
2020-12-14 11:26 ` David Laight
2020-12-14 12:08 ` gregkh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X9dVsI5CDbXEyU/w@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=David.Laight@aculab.com \
--cc=a-govindraju@ti.com \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=pawell@cadence.com \
--cc=peter.chen@nxp.com \
--cc=rogerq@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®