can: peak_usb: PCAN-USB specific part: fix little endian usage
authorStephane Grosjean <s.grosjean@peak-system.com>
Wed, 7 Mar 2012 14:31:30 +0000 (15:31 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 7 Mar 2012 14:51:01 +0000 (15:51 +0100)
That patch fixes some bad usage of two little-endian variables, which lead to
some warning/error when building the peak_usb driver.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/peak_usb/pcan_usb.c

index 8a7982e18e4ededc9c13c1d078b0d79508134b20..86f26a1ede4c18a233a85310b0bfb5f9a92da856 100644 (file)
@@ -741,16 +741,14 @@ static int pcan_usb_encode_msg(struct peak_usb_device *dev, struct sk_buff *skb,
 
        /* can id */
        if (cf->can_id & CAN_EFF_FLAG) {
-               __le32 tmp32 = cpu_to_le32(cf->can_id & CAN_ERR_MASK);
+               __le32 tmp32 = cpu_to_le32((cf->can_id & CAN_ERR_MASK) << 3);
 
-               tmp32 <<= 3;
                *pc |= PCAN_USB_STATUSLEN_EXT_ID;
                memcpy(++pc, &tmp32, 4);
                pc += 4;
        } else {
-               __le16 tmp16 = cpu_to_le32(cf->can_id & CAN_ERR_MASK);
+               __le16 tmp16 = cpu_to_le16((cf->can_id & CAN_ERR_MASK) << 5);
 
-               tmp16 <<= 5;
                memcpy(++pc, &tmp16, 2);
                pc += 2;
        }