summaryrefslogtreecommitdiff
path: root/drivers/net/can/usb/peak_usb/pcan_usb_core.c
diff options
context:
space:
mode:
authorStephane Grosjean <s.grosjean@peak-system.com>2014-12-05 16:11:09 +0300
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-12-07 23:04:03 +0300
commit62bc24f67abda56e486735706be6a4dea60fdb4c (patch)
tree98d698ba929c0484de8ded3d8f7ae670650ba3af /drivers/net/can/usb/peak_usb/pcan_usb_core.c
parentaf35d0f1cce7a990286e2b94c260a2c2d2a0e4b0 (diff)
downloadlinux-62bc24f67abda56e486735706be6a4dea60fdb4c.tar.xz
can: peak_usb: fix multi-byte values endianess
This patch fixes the endianess definition as well as the usage of the multi-byte fields in the data structures exchanged with the PEAK-System USB adapters. By fixing the endianess, this patch also fixes the wrong usage of a 32-bits local variable for handling the error status 16-bits field, in function pcan_usb_pro_handle_error(). Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/usb/peak_usb/pcan_usb_core.c')
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index dc807e10f802..c62f48a1161d 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -856,6 +856,7 @@ static int peak_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *usb_dev = interface_to_usbdev(intf);
+ const u16 usb_id_product = le16_to_cpu(usb_dev->descriptor.idProduct);
struct peak_usb_adapter *peak_usb_adapter, **pp;
int i, err = -ENOMEM;
@@ -863,7 +864,7 @@ static int peak_usb_probe(struct usb_interface *intf,
/* get corresponding PCAN-USB adapter */
for (pp = peak_usb_adapters_list; *pp; pp++)
- if ((*pp)->device_id == usb_dev->descriptor.idProduct)
+ if ((*pp)->device_id == usb_id_product)
break;
peak_usb_adapter = *pp;