linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Pawel Laszczak' <pawell@cadence.com>,
	"peter.chen@nxp.com" <peter.chen@nxp.com>
Cc: "rogerq@ti.com" <rogerq@ti.com>,
	"a-govindraju@ti.com" <a-govindraju@ti.com>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"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 11:26:22 +0000	[thread overview]
Message-ID: <d232a54761a7473692976188aba0a5f6@AcuMS.aculab.com> (raw)
In-Reply-To: <20201214110433.19461-1-pawell@cadence.com>

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)


  reply	other threads:[~2020-12-14 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 11:04 [PATCH] usb: cdns3: Fixes for sparse warnings Pawel Laszczak
2020-12-14 11:26 ` David Laight [this message]
2020-12-14 12:08   ` gregkh

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=d232a54761a7473692976188aba0a5f6@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=a-govindraju@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).