linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] peak_usb: PCAN-USB specific part: fix little endian usage
@ 2012-03-07 14:31 Stephane Grosjean
  2012-03-07 14:55 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Grosjean @ 2012-03-07 14:31 UTC (permalink / raw)
  To: linux-can Mailing List
  Cc: Dan Carpenter, linux-usb Mailing List, Stephane Grosjean

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>
---
 drivers/net/can/usb/peak_usb/pcan_usb.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c
index 8a7982e..86f26a1 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb.c
@@ -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;
 	}
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] peak_usb: PCAN-USB specific part: fix little endian usage
  2012-03-07 14:31 [PATCH] peak_usb: PCAN-USB specific part: fix little endian usage Stephane Grosjean
@ 2012-03-07 14:55 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2012-03-07 14:55 UTC (permalink / raw)
  To: Stephane Grosjean
  Cc: linux-can Mailing List, Dan Carpenter, linux-usb Mailing List

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

On 03/07/2012 03:31 PM, Stephane Grosjean wrote:
> 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>

Thanks - looks good. Applied to can-next.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-07 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07 14:31 [PATCH] peak_usb: PCAN-USB specific part: fix little endian usage Stephane Grosjean
2012-03-07 14:55 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).