diff mbox series

apple-mfi-fastcharge: fix endianess issue in probe

Message ID 20200213111336.32392-1-oneukum@suse.com (mailing list archive)
State Mainlined
Commit ca065bf12771078571dec758300631624edc19a2
Headers show
Series apple-mfi-fastcharge: fix endianess issue in probe | expand

Commit Message

Oliver Neukum Feb. 13, 2020, 11:13 a.m. UTC
The product ID is little endian and needs to be converted.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
 drivers/usb/misc/apple-mfi-fastcharge.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bastien Nocera Feb. 13, 2020, 11:16 a.m. UTC | #1
On Thu, 2020-02-13 at 12:13 +0100, Oliver Neukum wrote:
> The product ID is little endian and needs to be converted.
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Reported-by: kbuild test robot <lkp@intel.com>

Looks good, thanks for the quick fix!

Reviewed-by: Bastien Nocera <hadess@hadess.net>
diff mbox series

Patch

diff --git a/drivers/usb/misc/apple-mfi-fastcharge.c b/drivers/usb/misc/apple-mfi-fastcharge.c
index f1c4461a9a3c..b403094a6b3a 100644
--- a/drivers/usb/misc/apple-mfi-fastcharge.c
+++ b/drivers/usb/misc/apple-mfi-fastcharge.c
@@ -167,11 +167,11 @@  static int mfi_fc_probe(struct usb_device *udev)
 {
 	struct power_supply_config battery_cfg = {};
 	struct mfi_device *mfi = NULL;
-	int err;
+	int err, idProduct;
 
+	idProduct = le16_to_cpu(udev->descriptor.idProduct);
 	/* See comment above mfi_fc_id_table[] */
-	if (udev->descriptor.idProduct < 0x1200 ||
-	    udev->descriptor.idProduct > 0x12ff) {
+	if (idProduct < 0x1200 || idProduct > 0x12ff) {
 		return -ENODEV;
 	}