From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Jules Maselbas <jmaselbas@kalray.eu>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 4/6] usb: string: Use le16_to_cpu for langid
Date: Thu, 10 Oct 2019 13:41:45 -0700 [thread overview]
Message-ID: <CAHQ1cqGhrSnL6MMxea0wZb8o=ZGUpHb841VuxgTQj3A8=ypeLQ@mail.gmail.com> (raw)
In-Reply-To: <20191010081503.15254-4-jmaselbas@kalray.eu>
On Thu, Oct 10, 2019 at 1:15 AM Jules Maselbas <jmaselbas@kalray.eu> wrote:
>
> This might fix an endianness bug when the cpu is big-endian
> as the string_langid will be converted with `cpu_to_le16` when
> sending a control message to get a string descriptor.
>
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
> drivers/usb/core/usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> index e14b89b5e..5dc7993ac 100644
> --- a/drivers/usb/core/usb.c
> +++ b/drivers/usb/core/usb.c
> @@ -925,7 +925,7 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
> goto error;
> } else {
> dev->have_langid = -1;
> - dev->string_langid = tbuf[2] | (tbuf[3] << 8);
> + dev->string_langid = le16_to_cpu(*((__le16 *)&buf[2]));
Very minor, but looks like le16_to_cpup() might be a better fit here.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-10-10 20:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 8:14 [PATCH 1/6] usb: hub: Use more accurate struct name Jules Maselbas
2019-10-10 8:14 ` [PATCH 2/6] usb: hub: Only clear port reset status if set Jules Maselbas
2019-10-10 8:15 ` [PATCH 3/6] usb: string: Use dma_alloc instead of a local buffer Jules Maselbas
2019-10-10 8:15 ` [PATCH 4/6] usb: string: Use le16_to_cpu for langid Jules Maselbas
2019-10-10 20:41 ` Andrey Smirnov [this message]
2019-10-14 11:42 ` Sascha Hauer
2019-10-14 15:09 ` Jules Maselbas
2019-10-10 8:15 ` [PATCH 5/6] usb: string: size_t is unsigned Jules Maselbas
2019-10-10 8:15 ` [PATCH 6/6] usb: string: Minor changes Jules Maselbas
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='CAHQ1cqGhrSnL6MMxea0wZb8o=ZGUpHb841VuxgTQj3A8=ypeLQ@mail.gmail.com' \
--to=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=jmaselbas@kalray.eu \
/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