From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v2 3/4] usb: usb-uclass.c: Drop le16_to_cpu() as values are already swapped
Date: Tue, 21 Jul 2020 10:46:04 +0200 [thread overview]
Message-ID: <20200721084605.3801454-4-sr@denx.de> (raw)
In-Reply-To: <20200721084605.3801454-1-sr@denx.de>
These values are already swapped to CPU endianess, so swapping them
again is a bug. Let's remove the swap here instead.
Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
---
(no changes since v1)
drivers/usb/host/usb-uclass.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index cb79dfbbd5..aa08d4ffc6 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -416,21 +416,21 @@ static int usb_match_device(const struct usb_device_descriptor *desc,
const struct usb_device_id *id)
{
if ((id->match_flags & USB_DEVICE_ID_MATCH_VENDOR) &&
- id->idVendor != le16_to_cpu(desc->idVendor))
+ id->idVendor != desc->idVendor)
return 0;
if ((id->match_flags & USB_DEVICE_ID_MATCH_PRODUCT) &&
- id->idProduct != le16_to_cpu(desc->idProduct))
+ id->idProduct != desc->idProduct)
return 0;
/* No need to test id->bcdDevice_lo != 0, since 0 is never
greater than any unsigned number. */
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) &&
- (id->bcdDevice_lo > le16_to_cpu(desc->bcdDevice)))
+ (id->bcdDevice_lo > desc->bcdDevice))
return 0;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) &&
- (id->bcdDevice_hi < le16_to_cpu(desc->bcdDevice)))
+ (id->bcdDevice_hi < desc->bcdDevice))
return 0;
if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_CLASS) &&
--
2.27.0
next prev parent reply other threads:[~2020-07-21 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 8:46 [PATCH v2 0/4] usb: xhci: Prepare xHCI driver for MIPS Octeon big-endian support Stefan Roese
2020-07-21 8:46 ` [PATCH v2 1/4] usb: xhci: Add missing endian conversions (cpu_to_leXX / leXX_to_cpu) Stefan Roese
2020-07-21 8:46 ` [PATCH v2 2/4] usb: xhci: xhci_mem_init: Use cpu_to_le64() and not xhci_writeq() Stefan Roese
2020-07-21 8:46 ` Stefan Roese [this message]
2020-07-21 8:46 ` [PATCH v2 4/4] usb: xhci: Add virt_to_phys() to support mapped platforms Stefan Roese
2020-07-30 6:32 ` [PATCH v2 0/4] usb: xhci: Prepare xHCI driver for MIPS Octeon big-endian support Stefan Roese
2020-07-30 6:59 ` Bin Meng
2020-08-05 5:57 ` Stefan Roese
2020-08-05 7:31 ` Marek Vasut
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=20200721084605.3801454-4-sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/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