From: Oliver Neukum Date: Thu, 13 Feb 2020 11:13:36 +0000 (+0100) Subject: USB: apple-mfi-fastcharge: fix endianess issue in probe X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~2577^2~99 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=ca065bf12771078571dec758300631624edc19a2;p=linux.git USB: apple-mfi-fastcharge: fix endianess issue in probe The product ID is little endian and needs to be converted. Reported-by: kbuild test robot Signed-off-by: Oliver Neukum Reviewed-by: Bastien Nocera Link: https://lore.kernel.org/r/20200213111336.32392-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman --- 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; }